예제 #1
0
        public void TestPdfCleaner()
        {
            PdfCompiler m = new PdfCompiler("c:\\ds21vuoto.pdf", "c:\\ds21prova3.pdf");

            m.Setup();
            m.SetCampo("datanascita", "2/10/1984");
            m.SetCampo("nome", "paolo");
            m.Compile();
            m.Dispose();

            PdfCleaner n = new PdfCleaner("c:\\ds21prova3.pdf");

            n.Setup();
            n.CleanAllFields();

            n.Dispose();

            PdfDescriber c = new PdfDescriber("c:\\ds21prova3.pdf");

            c.Setup();
            System.Collections.Hashtable arr = c.GetFieldsInfoToHashtable();
            foreach (DictionaryEntry elem in arr)
            {
                Assert.AreEqual(c.GetField(elem.Key.ToString()), "");
            }

            c.Dispose();
            File.Delete("c:\\ds21prova3.pdf");
        }
예제 #2
0
        public void PdfCompilerTest()
        {
            PdfCompiler m = new PdfCompiler("c:\\ds21vuoto.pdf", "c:\\ds21prova.pdf");

            Assert.AreEqual(m.GetSorgente, "c:\\ds21vuoto.pdf");
            Assert.AreEqual(m.GetDestinazione, "c:\\ds21prova.pdf");
            m.Setup();
            m.SetCampo("nome", "paolo");
            m.SetCampo("cognome", "berardone");
            m.Compile();
            Assert.AreEqual(m.GetField("nome"), "paolo");
            Assert.AreEqual(m.GetField("cognome"), "berardone");

            m.ClearField("nome");
            Assert.AreEqual(m.GetField("nome"), "");

            m.Clear();
            Assert.AreEqual(m.GetField("nome"), "");
            Assert.AreEqual(m.GetField("cognome"), "");
            m.Dispose();
            File.Delete("c:\\ds21prova3.pdf");
        }