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");
}