Exemple #1
0
        public static void Run(
            String openPath,                            // source PDF document
            String savePath,                            // output PDF document
            bool preflight,                             // preflight page before tagging
            String language,                            // document reading language
            String title,                               // document title
            String configPath                           // configuration file
            )
        {
            Pdfix pdfix = PdfixEngine.Instance;

            PdfDoc doc = pdfix.OpenDoc(openPath, "");

            if (doc == null)
            {
                throw new Exception(pdfix.GetError());
            }

            var doc_template = doc.GetTemplate();

            // convert to PDF/UA
            PdfAccessibleParams accParams = new PdfAccessibleParams();

            if (!doc.MakeAccessible(accParams, null, null))
            {
                throw new Exception(pdfix.GetError());
            }

            if (!doc.Save(savePath, Pdfix.kSaveFull))
            {
                throw new Exception(pdfix.GetError());
            }

            doc.Close();
        }
Exemple #2
0
        public static void Run(
            String email,                               // authorization email
            String licenseKey,                          // authorization license key
            String openPath,                            // source PDF document
            String savePath,                            // output PDF document
            String language,                            // document reading language
            String title,                               // document title
            String configPath                           // configuration file
            )
        {
            Pdfix pdfix = new Pdfix();

            if (pdfix == null)
            {
                throw new Exception("Pdfix initialization fail");
            }

            if (!pdfix.Authorize(email, licenseKey))
            {
                throw new Exception(pdfix.GetError());
            }

            PdfDoc doc = pdfix.OpenDoc(openPath, "");

            if (doc == null)
            {
                throw new Exception(pdfix.GetError());
            }

            // convert to PDF/UA
            PdfAccessibleParams accParams = new PdfAccessibleParams();

            if (!doc.MakeAccessible(accParams, null, IntPtr.Zero))
            {
                throw new Exception(pdfix.GetError());
            }

            if (!doc.Save(savePath, PdfSaveFlags.kSaveFull))
            {
                throw new Exception(pdfix.GetError());
            }

            doc.Close();
            pdfix.Destroy();
        }