Esempio n. 1
0
        public virtual void TestImportedPage5()
        {
            String f1       = RESOURCES + "copy/pdfa-3a.pdf";
            String f2       = RESOURCES + "copy/pdfa-3u.pdf";
            String testName = "testImportedPage5.pdf";

            Stream   outputPdfStream = new FileStream(outputDir + testName, FileMode.Create);
            Document document        = new Document();
            PdfACopy copy            = new PdfACopy(document, outputPdfStream, PdfAConformanceLevel.PDF_A_3U);

            copy.CreateXmpMetadata();
            document.Open();

            foreach (String f in new String[] { f1, f2 })
            {
                PdfReader reader = new PdfReader(f);
                for (int i = 1; i <= reader.NumberOfPages; i++)
                {
                    copy.AddPage(copy.GetImportedPage(reader, i));
                }
            }

            FileStream iccProfileFileStream = File.Open(RESOURCES + "sRGB Color Space Profile.icm", FileMode.Open, FileAccess.Read,
                                                        FileShare.Read);
            ICC_Profile icc = ICC_Profile.GetInstance(iccProfileFileStream);

            iccProfileFileStream.Close();

            copy.SetOutputIntents("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", icc);
            copy.Close();
        }
Esempio n. 2
0
        public virtual void TestMergeFields1()
        {
            String f1       = RESOURCES + "copy/pdfa-1a.pdf";
            String f2       = RESOURCES + "copy/pdfa-1a-2.pdf";
            String testName = "testMergeFields1.pdf";

            FileStream outputPdfStream = new FileStream(outputDir + testName, FileMode.Create);
            Document   document        = new Document();
            PdfACopy   copy            = new PdfACopy(document, outputPdfStream, PdfAConformanceLevel.PDF_A_1A);

            copy.SetMergeFields();
            copy.CreateXmpMetadata();
            copy.SetTagged();
            document.Open();
            document.AddLanguage("en-US");
            foreach (String f in new String[] { f1, f2 })
            {
                PdfReader reader = new PdfReader(f);
                copy.AddDocument(reader);
            }

            FileStream iccProfileFileStream = File.Open(RESOURCES + "sRGB Color Space Profile.icm", FileMode.Open, FileAccess.Read,
                                                        FileShare.Read);
            ICC_Profile icc = ICC_Profile.GetInstance(iccProfileFileStream);

            iccProfileFileStream.Close();

            copy.SetOutputIntents("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", icc);
            copy.Close();
        }
Esempio n. 3
0
        public virtual void TestCreatePdfA_1()
        {
            String f1       = RESOURCES + "copy\\pdfa-1a.pdf";
            String testName = "testCreatePdfA_1.pdf";

            FileStream outputPdfStream = new FileStream(outputDir + testName, FileMode.Create);
            Document   document        = new Document();
            PdfACopy   copy            = new PdfACopy(document, outputPdfStream, PdfAConformanceLevel.PDF_A_1B);

            copy.CreateXmpMetadata();
            document.Open();
            document.AddLanguage("en-US");
            PdfReader reader = new PdfReader(f1);

            PdfImportedPage page = copy.GetImportedPage(reader, 1);

            PdfCopy.PageStamp stamp = copy.CreatePageStamp(page);
            Font font = FontFactory.GetFont(RESOURCES + "FreeMonoBold.ttf", BaseFont.WINANSI, BaseFont.EMBEDDED, 24);

            ColumnText.ShowTextAligned(stamp.GetUnderContent(), Element.ALIGN_CENTER, new Phrase("Hello world!", font), 100, 500, 0);
            stamp.AlterContents();
            copy.AddPage(page);

            FileStream iccProfileFileStream = File.Open(RESOURCES + "sRGB Color Space Profile.icm", FileMode.Open, FileAccess.Read,
                                                        FileShare.Read);
            ICC_Profile icc = ICC_Profile.GetInstance(iccProfileFileStream);

            iccProfileFileStream.Close();

            copy.SetOutputIntents("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", icc);
            copy.Close();
        }