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

Free Support Forum - aspose.com

Working with PDF/A documents. Merging single pages

Hi.

I am working with merging many single page PDF/A B1 documents together.

The way I merge them is like this:

Stream[] pdfStreams = … // all the single page PDF/A B1 filestreams
FileStream outputPdf = new FileStream(“out.pdf”, FileMode.Create);

PdfFileEditor pdfeditor = new PdfFileEditor();

pdfeditor.Concatenate(pdfStreams, outputPdf);


The resulting merged pdf file is not PDF/A compliant. I would have thought that since all the previous documents are PDF/A B1 then the resulting merged PDF document would also.

First question, is this expected?

---------------

Now I already have a way to make the resulting merged PDF document PDF/A compliant. I do that like so:

FileInfo fileToConvert = …
Document doc = new Document(fileToConvert.FullName);
bool successInConverting = doc.Convert(fileToConvert.FullName+".xml" , PdfFormat.PDF_A_1B, ConvertErrorAction.None);
doc.Save(“outpdfA.pdf”);

This feel like an unneccessery step and I would like to avoid it.

Second question, is this simply the way to do it?

Simmi:
I am working with merging many single page PDF/A B1 documents together.

The way I merge them is like this:

Stream[] pdfStreams = ... // all the single page PDF/A B1 filestreams
FileStream outputPdf = new FileStream("out.pdf", FileMode.Create);

PdfFileEditor pdfeditor = new PdfFileEditor();

pdfeditor.Concatenate(pdfStreams, outputPdf);


The resulting merged pdf file is not PDF/A compliant. I would have thought that since all the previous documents are PDF/A B1 then the resulting merged PDF document would also.

First question, is this expected?
Hi Sigmundur,

Thanks for contacting support.

The PDF/A compliance is used for long term preservation of document and to ensure that file contents are not changed. When concatenating the document, you are actually modifying the file structure and therefore PDF/A compliance is lost.
Simmi:
---------------

Now I already have a way to make the resulting merged PDF document PDF/A compliant. I do that like so:

FileInfo fileToConvert = ...
Document doc = new Document(fileToConvert.FullName);
bool successInConverting = doc.Convert(fileToConvert.FullName+".xml" , PdfFormat.PDF_A_1B, ConvertErrorAction.None);
doc.Save("outpdfA.pdf");

This feel like an unneccessery step and I would like to avoid it.

Second question, is this simply the way to do it?

The Convert(..) method of Document class is correct approach for transforming a PDF document to PDF/A compliant format. The approach is correct.