Welcome Guest Search | Active Topics | Sign In | Register

htmltopdf combined with single templated page Options
soppie
Posted: Monday, July 8, 2019 11:53:52 AM
Rank: Newbie
Groups: Member

Joined: 11/6/2018
Posts: 9
Hi,

maybe overlooking the obvious, but can't seem to find any hint on this one.
Using eo for a number of years now with htmltopdf functionality, but now I'm looking for a way to use a single page pdf document (empty, only with a logo and some text on it in the footer) to add the html content. I use the css pagebreak functionality, so for every new pdf page needed, it should use the base pdf file to write on.

thx!
eo_support
Posted: Monday, July 8, 2019 10:21:56 PM
Rank: Administration
Groups: Administration

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

You will need to do this by calling the converter twice. The basic steps are:

1. Calling the converter once. The purpose of the this run is to find out how many pages the output will be;
2. Using PdfDocument.Merge to generate a template PDF file that contains exactly that number of pages using your one page template file;
3. Calling the converter again and pass the result PdfDocument you generated in step 2 as the output PdfDocument;

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

Thanks!
soppie
Posted: Tuesday, July 9, 2019 11:58:15 AM
Rank: Newbie
Groups: Member

Joined: 11/6/2018
Posts: 9
Oke that got me on my way, tried the steps:

1. the converter generates 4 pages in doc1
2. I merge my empty template page doc2 to a new pdfdocument doc3 4 time with a loop
3. I call the converter again and use doc3 to put the html content in it

the result is a pdf with 4 empty template pages (page 1-4) and 4 pages (page 5-8) with the url content on it but not over my template page.
Can you give a basic code example?

thx!




eo_support
Posted: Tuesday, July 9, 2019 1:05:30 PM
Rank: Administration
Groups: Administration

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

Please try to set HtmlToPdf.Options.StartPageIndex to 0.

Thanks!
soppie
Posted: Tuesday, July 9, 2019 1:07:50 PM
Rank: Newbie
Groups: Member

Joined: 11/6/2018
Posts: 9
Yep, that did it thx for the help!
eo_support
Posted: Tuesday, July 9, 2019 1:13:18 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Great!


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.