Exemple #1
0
        public virtual void InspectSignatures(String path)
        {
            Console.WriteLine("\n\n");
            PdfDocument          pdfDoc   = new PdfDocument(new PdfReader(path));
            PdfAcroForm          form     = PdfAcroForm.GetAcroForm(pdfDoc, false);
            SignaturePermissions perms    = null;
            SignatureUtil        signUtil = new SignatureUtil(pdfDoc);
            IList <String>       names    = signUtil.GetSignatureNames();

            Console.WriteLine(path);
            foreach (String name in names)
            {
                Console.Out.WriteLine("===== " + name + " =====");
                perms = InspectSignature(pdfDoc, signUtil, form, name, perms);
            }
            PdfAConformanceLevel conformanceLevel = pdfDoc.GetReader().GetPdfAConformanceLevel();
            string conformance = conformanceLevel == null ? string.Empty : conformanceLevel.GetConformance();
            string part        = conformanceLevel == null ? string.Empty : conformanceLevel.GetPart();

            Console.Out.WriteLine($"Document conformance: {conformance}/{part}");
            GetMetaInfo(pdfDoc);
        }
Exemple #2
0
        public Task <bool> IsPdfA2B(MemoryStream input)
        {
            PdfDocument inputPdf = new PdfDocument(new PdfReader(input));

            try
            {
                PdfAConformanceLevel conformanceLevel = inputPdf.GetReader().GetPdfAConformanceLevel();
                var conformance = conformanceLevel.GetConformance();
                var part        = conformanceLevel.GetPart();

                return(Task.FromResult(conformance.Equals("B") && part.Equals("2")));
            }
            catch (Exception)
            {
                return(Task.FromResult(false));
            }
            finally
            {
                inputPdf.Close();
                input.Dispose();
            }
        }