Welcome Guest Search | Active Topics | Sign In | Register

Set background of each page to a page from another PDF (template) file Options
Wietse Kok
Posted: Tuesday, November 3, 2015 3:09:30 AM
Rank: Newbie
Groups: Member

Joined: 11/3/2015
Posts: 1
Dear all,

Is it possible, like with iTextSharp, to load a content from another PDF which only have 1 page and set this content as the background of each page (eg. invoices have a header and footer normally) ?

Thanks,

Wietse Kok
eo_support
Posted: Tuesday, November 3, 2015 8:47:44 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

Yes. It is possible for you to do that. You would simply generate new output to that document. For example:

Code: C#
//Load the template file
PdfDocument doc = new PdfDocument(your_template_file_name);

//Generate output
HtmlToPdf.ConvertUrl(your_url, doc);

//Save the file
doc.Save(result_file);


Note that you may need to make sure that your template document has enough pages. You can do so by following these steps:

1. Create your template PDF file as one page only;
2. Call ConvertUrl first on an empty PdfDocument (new PdfDocument()) object and then use the PdfDocument.Pages.Count to find out the total page numbers;
3. Use PdfDocument.Merge to produce a template file with exact the number of pages you have in step 2;
4. Call ConvertUrl on this new template file;

Hope this helps. Please feel free to let us know if you still have any questions

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.