Free Support Forum - aspose.com

Copy layers while concatenating PDF files in C# using Aspose.PDF for .NET

aspose.pdf.test.pdf (30.8 KB)

This file has one layer of yellow line.
And if I saving this file in Aspose.PDF than this line is appearing

I use this code.

Aspose.Pdf.Document pdfDocument2 = new Aspose.Pdf.Document(src);
Aspose.Pdf.Document newDocument2 = new Aspose.Pdf.Document();
foreach (Aspose.Pdf.Page pdfPage2 in pdfDocument2.Pages)
{
newDocument2.Pages.Add(pdfPage2);
}
newDocument2.Save(@“e:\test\test.pdf”);

and this code is always null.

if (pdfPage2.Layers == null)
{
// === NULL ===
}
else
{
// === NOT NULL ===
}

how can I copy this file’s layers?

@woosik.gong

Thanks for contacting support.

We were able to notice the issue in our environment while using Aspose.PDF for .NET 20.1 and logged it as PDFNET-47554 in our issue tracking system for the sake of correction. We will further look into details of it and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.