Hi Aspose forum!
I have come across possibly faulty behavior while using the latest version of Aspose.PDF.
My specific use case involves the following steps in order:
- Convert a 2-page PDF/A conforming document to PDF 1.7 and using the
RemovePdfaCompliance()
method on it. - Apply a text-based stamp to only the first (or second) page using the
TextStamp
class - Convert back to a PDF/A format.
This last step causes a corrupt/blank page on whichever page was not stamped, even though there are no conversion errors thrown.
Additionally, applying a TextStamp
to a PDF/A document directly, without converting it to a PDF 1.7 and calling RemovePdfaCompliance()
, also causes faulty behavior and results in a corrupted page:
- If no page is stamped, there are no visual issues.
- If both pages are stamped, there are (seemingly) no visual issues.
- If only one page is stamped, the other page is blank and/or corrupted.
Using a different conversion tool (not Aspose.PDF) causes the following exception attempting to convert the stamped PDF document to a PDF/A format: Recoding to PDF/A: Unsupported entry 'DefaultValue' found in Page Tree Node. (PDF_PDF_A_Unknown_Entry) 13
I have created a simple .NET application to replicate this behavior: ReproduceAsposePdfaIssue.zip (20.6 KB)
It uses this document as an input file: documents.zip (175.1 KB)
This zip file also contains the output file which was produced by running the program.
Note that I did not include the license or NuGet dependencies, so you need to add your license as ReproducePdfaIssue.Properties.Resources.Aspose_Total_NET
and install the latest version of Aspose.PDF
.
It would be nice to get an explanation on why this could happen as I’m not familiar with the specific behind the scenes workings of the TextStamp
class in this scenario, or how it handles PDF/A compliant documents. It seems odd that I can apply a TextStamp
to a PDF/A document that is marked as isPdfaCompliant
without an exception, resulting in a faulty document.
Regardless of the issues here it also seems strange that the Convert
method of the Aspose.PDF.Document
object does not produce an exception creating a faulty PDF document.