Welcome Guest Search | Active Topics | Sign In | Register

Different outputarea for first page Options
Kenny
Posted: Tuesday, September 29, 2015 10:47:57 AM
Rank: Newbie
Groups: Member

Joined: 9/29/2015
Posts: 3
Hi,

I have a problem,
How can i have multiple outputarea's within 1 document conversion?

Problem: i have a (dynamicaly created) html where i don't know how long it will be.
The first page should be starting with a topmargin of 0.5F and all other pages with 2.5F

But i really don't know how to do this.
i tried with BeforeRenderPage or AfterRenderPage
and then reset the outputarea after the first page is generated, but it doesn't work that way i guess.

thanks for the help!
Kenny
eo_support
Posted: Tuesday, September 29, 2015 1:52:11 PM
Rank: Administration
Groups: Administration

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

You can do something like this:

Code: C#
//This set the OutputArea to have a 2.5f top margin for all pages
HtmlToPdf.Options.OutputArea = new RectangleF(1f, 2.5f, 6.5f, 7.5f);

//This explicitly set the start position for the first page as
//2.5f + (-2) = 0.5f
HtmlToPdf.Options.StartPosition = -2;


The second line is the key. Please let us know if this works for you.

Thanks!
Kenny
Posted: Wednesday, September 30, 2015 2:53:03 AM
Rank: Newbie
Groups: Member

Joined: 9/29/2015
Posts: 3
Hello,
I tried this, and it works, only it will break my page t0o early (there is a white margin of 2 on the bottom of the first page.
I would like to have a full page, where the outputarea of the first page is RectangleF(0.5F, 0.5F, 7.4F, 10.5F) and of all the next pages RectangleF(0.5F, 2.5F, 7.4F, 8.5F)

But it is a start, so thanks for this solution.
eo_support
Posted: Wednesday, September 30, 2015 9:30:48 AM
Rank: Administration
Groups: Administration

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

We have looked into this and it would require code changes on our end. We will make the change and post a new build either later this week or early next week. After that you will be able to use the same code to achieve the expected result.

Thanks!
Kenny
Posted: Wednesday, September 30, 2015 11:05:56 AM
Rank: Newbie
Groups: Member

Joined: 9/29/2015
Posts: 3
Thank you very much!
Can you keep in touch for this release?
eo_support
Posted: Monday, October 5, 2015 8:49:21 PM
Rank: Administration
Groups: Administration

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

This is just to let you know that we have posted a new build that supports this. You can download the new build from the download page. The code will still be the same (using negative StartPosition).

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.