Hi, I’m currently evaluating your product Aspose.PDF in combination with Aspose.Words for merging Word- & PDF-files to a single PDF-A file. Unfortunately there’s some difficulties with the conversion (according to the log file).<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” />
I started off with a new Document and “merged” pdf-files by adding them to its page collection which caused convert problems. If I ignore the problem (success-boolean) and save the file to disk it opens correctly as a PDF-A document. To minimize the problems I stopped adding any pages to see what happened, the following code still causes validation problems:
var mergedPdf = new Aspose.Pdf.Document();
var success = mergedPdf.Validate(logFilePath, PdfFormat.PDF_A_1A); success = mergedPdf.Convert(logFilePath, PdfFormat.PDF_A_1A, ConvertErrorAction.Delete);
The logFilePath-result:
The stream dictionary contains ‘N’ key
Metadata key does not exists
The trailer dictionary does not contain ‘ID’
Through the help of callas software ••• PDF works we tracked down the solution to the two last errors, it is a mismatch for CreationDate.
To solve those we applied the following code:
var pdfGenerator = new Aspose.Pdf.Generator.Pdf();
pdfGenerator.Conformance = PdfConformance.PdfA1A;
pdfGenerator.XmpMetadata = new Aspose.Pdf.Generator.XmpMetadata();
pdfGenerator.XmpMetadata.AddCreationDate(DateTime.Now.ToString());
pdfGenerator.Save(mergedPdfStream);
var mergedPdf = new Aspose.Pdf.Document(mergedPdfStream);
mergedPdf.Pages.Delete();
var success = mergedPdf.Validate(logFilePath, PdfFormat.PDF_A_1A); success = mergedPdf.Convert(logFilePath, PdfFormat.PDF_A_1A, ConvertErrorAction.Delete);
We still receive a problem with “The stream dictionary contains ‘N’ key” though which I haven’t been able to track down what it actually means:
<Compliance Name="Log" Operation="Validation" Target="PDF/A-1a">
<Version>1.0</Version>
<copyright>Copyright 2011 Aspose ltd</copyright>
<Date>2011-10-03 16:19:58</Date>
<file Version="1,4" Name="test.pdf" Pages="0">
<Issues>
<Catalog>
<objects>
<Problem Severity="Error" Clause="6.1.7" ObjectID="21" Convertable="True">The stream dictionary contains 'N' key</Problem>
</objects>
<xObjects />
<actions />
<Header />
<Annotations />
<Metadata />
<Fonts />
<trailer />
</Catalog>
</Issues>
</file>
</Compliance>
Should we just ignore this error or have we done anything wrong in our coding? Also when specifying PdfFormat.PDF_A_1B (less strict) the error log still says Target=“PDF/A-1a” .
Sincerely
Magnus