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

Free Support Forum - aspose.com

Concatenate PDF into a linearized PDF

Hello,

I am using PdfFileEditor.Concatenate to concatenate PDFs.
Is there an option to linearize the result PDF as its PDF parts get concatenated?

The alternative of reloading the document (after Concatenate is completed) and
saving it as via Document.Optimize() is very time consuming for the large PDF
I am trying to handle.

Thanks for your help.

@PeteLee

Thank you for contacting support.

You can Linearize a PDF document with IsLinearized property which is exposed by Document class. Please try using below code snippet in your environment and then share your kind feedback with us.

// Load source document
Document document = new Document("Test.pdf");

// Set IsLinearized to true
document.IsLinearized = true;

// Save the updated PDF document
document.Save("Linearized.pdf");

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

Farhan,
Thanks for your reply.

My use case is given several thousand input PDF pages, I need to combine them into a single (very long) linearized PDF.

I currently used your PdfEditor Concatenate method to merge the pages (which may take several minutes
to run). I also tried adding one page at the time (via Pages.Add).

Adding an additional step to linearize the large concatenated PDF makes the processing even slower.

I was wondering if there was a way to obtain a linearized PDF as a result of the Concatenate function.

Also any alternative way to solve the problem would be appreciated.

@PeteLee

Please note Concatenate method does not create linearized PDF document and you need to linearize it with additional step suggested previously. Moreover, you may also try to add all pages to other document, at once instead of one page at a time, as explained in Concatenate PDF Files.