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

Free Support Forum - aspose.com

Add Layer on existing PDF using C# with Aspose.PDF for .NET

Hi, I have in existing pdf file and i would like to add a layer on it (basically a logo picture).

Can you help me please ?

Result :

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I am afraid; your requested feature regarding adding layers in existing PDF documents is not supported at the moment. I have created a new feature request in our issue tracking system with issue id: PDFNEWNET-34209. Our development team will further look into this feature and see if it can be supported in near future.

Sorry for the inconvenience,

That’s too bad… thank you very much for your help!

The issues you have found earlier (filed as PDFNEWNET-34209) have been fixed in Aspose.Pdf for .NET 9.3.0.

Blog post for this release can be viewed over this link

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Jean-Louis,

Thanks for your patience.

I am pleased to share that the feature requested earlier as PDFNEWNET-34209 is implemented in latest release of Aspose.Pdf for .NET 9.4.0. Please try using the following code snippet.


Document doc = new Document();<o:p></o:p>

Page page = doc.Pages.Add();

Layer layer = new Layer("oc1", "Red Line");

layer.Contents.Add(new Operator.SetRGBColorStroke(1, 0, 0));

layer.Contents.Add(new Operator.MoveTo(500, 700));

layer.Contents.Add(new Operator.LineTo(400, 700));

layer.Contents.Add(new Operator.Stroke());

page.Layers = new ArrayList();


layer = new Layer("oc2", "Green Line");

layer.Contents.Add(new Operator.SetRGBColorStroke(0, 1, 0));

layer.Contents.Add(new Operator.MoveTo(500, 750));

layer.Contents.Add(new Operator.LineTo(400, 750));

layer.Contents.Add(new Operator.Stroke());


layer = new Layer("oc3", "Blue Line");

layer.Contents.Add(new Operator.SetRGBColorStroke(0, 0, 1));

layer.Contents.Add(new Operator.MoveTo(500, 800));

layer.Contents.Add(new Operator.LineTo(400, 800));

layer.Contents.Add(new Operator.Stroke());