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

Free Support Forum - aspose.com

Preserve layers when exporting pages

I have a source PDF with layers. My ultimate goal is to take several such source PDFs and combine the pages into a single new PDF. However, the layers must remain intact in the output document. As a test, I simply tried to copy a single page from a single file and export it to another file. When I do this though, the layers are not present in the output PDF.

How can I export pages such that layers are preserved? Thanks!

static void Main(string[] args)
{

Document pdfDocument = new Document(@"C:\Temp\Test\input.pdf");

Page pdfPage = pdfDocument.Pages[1];

Document newDocument = new Document();

newDocument.Pages.Add(pdfPage);

newDocument.Save(@"C:\Temp\Test\output.pdf");

}

Hi there,


Thanks for your inquiry. Please use PdfFileEditor to concatenate, it support the layer copying and preserves layers. Hopefully your issue will be resolved. If issue persist then please share your sample documents here. so we will test the scenario at our end and will provide you more information accordingly.

Please feel free to contact us for any further assistance.

Best Regards,

That worked - thanks for the help!

Hi there,


Thanks for your feedback. Its good to know you have managed to fulfill your requirements with purposed suggestion.

Please feel free to contact us for any further assistance.

Best Regards,