We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF no longer PDF/A-2B conform after signing

Hi,

when I sign the pdf, the pdf isn’t PDF/A-2B conform afterwards. The PreFlight of Adobe tells me, that the font “Arial” is not embedded.

Is there a way to embed the font of the signature?

Kind regards,
Marco

@marcowillimann

Thank you for contacting support.

Would you please share the source and generated files along with the code snippet reproducing this behavior. Please ZIP all relevant files including the PFX file and the password for it, and share with us so that we may investigate further to help you out.

Hi,

herewith I send you all the files. Test.zip (33.8 KB)

The report.pdf is the pdf which is PDF/A-2B conform before signing it.

And here is the code I use to sign the pdf. The output pdf is no longer PDF/A-2B conform.

var pdfPath = @"C:\Report.pdf";

                            // Sign the PDF/A-2B with the certificate
                            using (var doc = new Aspose.Pdf.Document(pdfPath))
                            {
                                using (var signature = new PdfFileSignature(doc))
                                {
                                    var certPath = @"C:\test.pfx";
                                    var certPwd = @"1234";
                                    var outputPath = @"C:\outputReport.pdf";

                                    var certificate = new PKCS7(certPath, certPwd);
                                    // sign the pdf
                                    signature.Sign(1, true, new System.Drawing.Rectangle(0, 0, 100, 100), certificate);
                                    // Save output PDF file
                                    signature.Save(outputPath);
                                }
                            }

@marcowillimann

Thank you for sharing requested data.

We would like to share with you that sign functionality changes internal document structure and these changes can affect PDF/A compliance. So to avoid these side effects it is necessary to convert document after it was signed. If document was PDF/A originally, it must be converted into the same PDF/A format again after applying signatures. Document instance must be created from saved file cause operation signature.Save method violates some PDF/A requirements. Thus, please append below lines of code to your snippet and then share your kind feedback with us.

    ...
    signature.Save(outputPath);
    doc.Convert(dataDir + "ConversionLog.xml", PdfFormat.PDF_A_2B, ConvertErrorAction.Delete);
    doc.Save(dataDir + "TestPDFA_18.5.pdf");
    ...

We hope this will be helpful. Please feel free to contact us if you need any further assistance.

Thanks for your response. Your code is not working for me. Unfortunately, the pdf is not correctly signed afterwards! Any other ideas? Attached you find the conversion log
ConversionLog.zip (540 Bytes)

@marcowillimann

Would you please share updated code snippet and generated PDF file for our reference. Before sharing requested data, please ensure using Aspose.PDF for .NET 18.5 in your environment.

Hi,

the code is:

var pdfPath = @"C:\Report.pdf";
// Sign the PDF/A-2B with the certificate
using (var doc = new Aspose.Pdf.Document(pdfPath))
{
	using (var signature = new PdfFileSignature(doc))
	{
		var certPath = @"C:\test.pfx";
		var certPwd = @"1234";
		var outputPath = @"C:\ReportSigned.pdf";
		var outputPath2 = @"C:\test\ReportSignedAndConverted.pdf";
		var certificate = new PKCS7(certPath, certPwd);
		// sign the pdf
		signature.Sign(1, true, new System.Drawing.Rectangle(0, 0, 100, 100), certificate);
		// Save output PDF file
		signature.Save(outputPath);		
		using (var doc2 = new Aspose.Pdf.Document(outputPath))
		{
			doc2.Convert(new MemoryStream(), PdfFormat.PDF_A_2B, ConvertErrorAction.Delete);
			doc2.Save(outputPath2);
		}		
	}
}

Attached you find the output pdfs.
Reports.zip (158.5 KB)

Kind regards,
Marco

@marcowillimann

Thank you for sharing requested data.

We have logged an investigation ticket with ID PDFNET-44836 in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

@Farhan.Raza

You can close this ticket. It’s almost a month ago and I didn’t get any response. So in the meanwhile we replaced aspose.pdf component and use now PDFTools… With this component everything works like a charm!

Kind regards,
Marco

@marcowillimann

We are afraid that logged ticket is still pending for investigations because resolution of tickets logged under free support model usually takes a few months, owing to previously logged tickets.

However, for your kind information, we also offer Paid Support, where issues are used to be investigated with higher priority. Our customers, who have paid support subscription, report their issue there which are meant to be investigated urgently. For further information, you may visit Paid Support FAQs.

We are sorry for the inconvenience.