We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use the existing PDF as a background for the new PDF file?

Platform: WinForms |
Control: PDF
Tags: pdf, background

To use the existing PDF file as a background for the new PDF file, create a Page template of the existing document, then draw the template in the new document Page. The following code example illustrates how to use the existing PDF file as a background for the new PDF file.

C#

//Loads the Pdf document
PdfLoadedDocument ldoc = new PdfLoadedDocument("imageDoc.pdf");
//Gets the particular page from Loaded document pages
PdfLoadedPage lpage = ldoc.Pages[0] as PdfLoadedPage;
//Create template for the Loaded Page
PdfTemplate template = lpage.CreateTemplate();
//Creates new Pdf document
PdfDocument doc = new PdfDocument();
//Adds new Page
PdfPage page= doc.Pages.Add();
//Sets document page margins to zero
doc.PageSettings.Margins.All = 0;
//Draws Loaded page as background in the new pdf page using template of the loaded page.
page.Graphics.DrawPdfTemplate(template, new PointF(0,0),page.Size);
//Save the document and dispose it.
doc.Save("sample.pdf");
doc.Close();

Sample Link:

https://www.syncfusion.com/downloads/support/directtrac/general/PdfBackground-666474198.zip

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile