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

Free Support Forum - aspose.com

Stamp on multiple pages after doc.Pages.Add()


When I create a new page for my document with

var page = doc.Pages.Add();

And add a floating box in it, that creates multiple pages as result, because of long text content, I cant access these other pages to add stamps to it.

My doc.Pages have still just 1 page inside. I added an example project as attachment. I need the background.pdf on all generated pages and not just the first one. Could you help me with this?

Hi Philipp,

Thanks for your inquiry. You may add footer to page object as following it will add to all the pages created by the page object.

var page = doc.Pages.Add();<o:p></o:p>



page.Footer = footer;

Please feel free to contact us for any further assistance.

Best Regards,

Thanks for your answer.

My problem is, that my background image (PdfPageStamp) is added to the page object and only displayed on the first page. So you said I could add it to the footer because the footer is rendered on all pages. But how can I add a PdfPageStamp to a footer? I just can add paragraphs to a HeaderFooter object.

backgroundDocument = new Document(string.Concat(dir, “background.pdf”));
var background = new PdfPageStamp(backgroundDocument.Pages[1]) { Background = true };
footer = new HeaderFooter();
… ???
footer.Paragraphs.Add(background); // this will not work
page.Footer = footer;

And will this added item in the footer be rendered over the whole page behind the other content?

The challenge is to set a background (from a PDF file) on all pages, that may be generated by my FloatingBox.

By the way: I tried to add a pagination to the page object, that is also just displayed on the first page in the output.

Hi Philipp,

Thanks for your inquriy. Please note I have suggested you to use footer object as the approach was used in your code shared in first post. If you want to add Pdf page stamp in your PDF document then please find attached sample code snippet. Please note when we are creating a new PDF document, it is created dynamically by API and in order to get real PDF document(pages) we need to render its programming/dynamic model. We can render PDF document model by calling Save() method or ProcessParagraph(). I have used ProrcessParagraph() method to render real pages.

I have noticed that 11.5.0 is not working as expected, it is throwing NullReference Exception on AddStamp method, but it is working fine in 11.4.0. So I have logged a ticket PDFNEWNET-40600 in our issue tracking system to rectify the issue. We will notify you as soon as it is resolved.

Furthermore, In reference to pagination issue please share your sample code here, we will look into it and will guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,

doc.ProcessParagraphs(); did the trick! Now I can access each page and add stamps and page numbers to it. Thank you!

Hi Philipp,

Thanks for your feedback. It is good to know that you have managed to accomplish your requirement with the share information.

Please keep using our API and feel free to contact us for any question or concern, we will be more than happy to extend our support.

Best Regards,

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

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