Example #1
0
        static void Main(string[] args)
        {
            PDFNet.Initialize();
            PDFNet.SetColorManagement(PDFNet.CMSType.e_lcms);              // Required for PDFA validation.

            //-----------------------------------------------------------
            // Example 1: PDF/A Validation
            //-----------------------------------------------------------
            try
            {
                string filename = "newsletter.pdf";
                using (PDFACompliance pdf_a = new PDFACompliance(false, input_path + filename, null, PDFACompliance.Conformance.e_Level1B, null, 10, false))
                {
                    PrintResults(pdf_a, filename);
                }
            }
            catch (pdftron.Common.PDFNetException e)
            {
                Console.WriteLine(e.Message);
            }

            //-----------------------------------------------------------
            // Example 2: PDF/A Conversion
            //-----------------------------------------------------------
            try
            {
                string filename = "fish.pdf";
                using (PDFACompliance pdf_a = new PDFACompliance(true, input_path + filename, null, PDFACompliance.Conformance.e_Level1B, null, 10, false))
                {
                    filename = "pdfa.pdf";
                    pdf_a.SaveAs(output_path + filename, true);
                }

                // Re-validate the document after the conversion...
                filename = "pdfa.pdf";
                using (PDFACompliance pdf_a = new PDFACompliance(false, output_path + filename, null, PDFACompliance.Conformance.e_Level1B, null, 10, false))
                {
                    PrintResults(pdf_a, filename);
                }
            }
            catch (pdftron.Common.PDFNetException e)
            {
                Console.WriteLine(e.Message);
            }

            Console.WriteLine("PDFACompliance test completed.");
        }