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

Free Support Forum - aspose.com

Cross reference table is split into separate subsections

We get a problem in signing a PDF generated with Aspose.PDF.

The problem is caused by an error in the PDF generated by Aspose.PDF: The cross reference table of the initial revision in a PDF must not be split into separate subsections but PDF generated by Aspose.PDF do split it.

The details are described here: https://stackoverflow.com/questions/68801701/pades-ltv-signing-of-a-pdf-a-3a-document-yields-invalid-signature#

@studs0815

The archive contains 3 PDF files and two of them are created using Aspose.PDF for .NET 21.3. We also checked the related post on stackoverflow but could not find the code snippet which was used to save/generate these documents in the first place. Please share how you are creating the document using Aspose.PDF for .NET after which the issue is occurring. Also, please share the sample certificate file which was used to sign the document. We will test the scenario in our environment and address it accordingly.

Hi there,

Attached an Example FileTest_Produkt_Service_contract.pdf (262.7 KB)

Here the way we genereate the pdf documents:

public static byte[] ConvertWordFileToPdfA(byte[] wordFile) {
return ConvertWordFileToPdf(wordFile)
.OnSuccess(ConvertPdfFileToPdfA).Value;
}

public static Result<byte[]> ConvertWordFileToPdf(byte[] wordFile) {
if (wordFile == null) {
throw new ArgumentNullException(nameof(wordFile));
}

        using (MemoryStream stream = new MemoryStream(wordFile)) {
            Document wordDocument = new Document(stream);

            using (MemoryStream pdfDocument = new MemoryStream()) {
                wordDocument.Save(pdfDocument, SaveFormat.Pdf);
                pdfDocument.Flush();
                pdfDocument.Position = 0; 
                return Result.Ok(pdfDocument.ToArray());
            }
        }
    }
	
	
	
	
	  public static Result<byte[]> ConvertPdfFileToPdfA(byte[] pdfFile) {
        if (pdfFile == null) {
            throw new ArgumentNullException(nameof(pdfFile));
        }

        using (MemoryStream stream = new MemoryStream(pdfFile)) {
            Aspose.Pdf.Document document = new Aspose.Pdf.Document(stream);

            //Der Log-Stream wird nicht benötigt.
            using (MemoryStream logStream = new MemoryStream()) {
                //konvertieren
                document.Convert(logStream, Aspose.Pdf.PdfFormat.PDF_A_3A, Aspose.Pdf.ConvertErrorAction.Delete);
            }

            using (MemoryStream pdfStream = new MemoryStream()) {
                document.Save(pdfStream);
                return Result.Ok(pdfStream.ToArray());
            }
        }
    }

@nowhowmartin

Thanks for sharing the sample PDF and code snippet.

The PDF you shared seems like the final output. Please also share the same PDF that you achieve after converting from Word and before converting to PDF/A. Furthermore, as per your understandings, the issue is occurring when you sign the PDF document. Please share the way how you are signing the document so that we can proceed further with the investigation.

Hi there,

Informatione how the signing is done are available under : https://stackoverflow.com/questions/68801701/pades-ltv-signing-of-a-pdf-a-3a-document-yields-invalid-signature#

Attached the pdf before convertingtest.pdf (86.2 KB)

@nowhowmartin

An investigation ticket as PDFNET-50579 has been logged in our issue tracking system for this scenario. We will look into its details and let you know as soon as it is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.