Welcome Guest Search | Active Topics | Sign In | Register

HTML to PDF page headers Options
Posted: Friday, April 29, 2011 3:03:03 PM
Rank: Member
Groups: Member

Joined: 4/20/2011
Posts: 19
Is there any way to define multiple page headers? I have a html based generated report that sometimes goes to two pages. My client is needing a different header on the second page and their standard header on the first page. The report typically only is one page long, but at times it is 2 and when it is I need to be able to denote this.

Thanks for the help, response.

Sam
eo_support
Posted: Friday, April 29, 2011 3:06:33 PM
Rank: Administration
Groups: Administration

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

You can set HtmlToPdf.Options.AfterRenderPage and then generate any output inside that handler. You can output anything there, it doesn't have to be page header/footer.

Thanks!
Posted: Friday, April 29, 2011 3:58:11 PM
Rank: Member
Groups: Member

Joined: 4/20/2011
Posts: 19
Ok i finally was able to get that working, and now it is displaying the header on the 2nd page, however the pdf is cutting off the last line of the first page and putting half on the first and half on the 2nd. Is there anything that can be done to prevent this other than modifying the margins, or report data?
eo_support
Posted: Friday, April 29, 2011 4:01:03 PM
Rank: Administration
Groups: Administration

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

Please check whether you have the latest version of the DLL (3.0.30.2). The latest build is better at avoiding cutting off text.

The converter automatically tries to avoid breaking text lines but it is not always possible if you have multiple columns of text that are not aligned. In that case it's possible that no matter where you break the page, some text will be cut off.

Thanks
Posted: Friday, April 29, 2011 4:01:35 PM
Rank: Member
Groups: Member

Joined: 4/20/2011
Posts: 19
Another question about this, is there a method to set the margins differently, ie first page would have its margins, and 2nd page would have its as well.
eo_support
Posted: Friday, April 29, 2011 4:03:53 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
You will have to call ConvertHtml or ConvertUrl multiple times for that. You can then use different margin settings for each call.
Posted: Friday, April 29, 2011 4:04:07 PM
Rank: Member
Groups: Member

Joined: 4/20/2011
Posts: 19
eo_support wrote:
Hi,

Please check whether you have the latest version of the DLL (3.0.30.2). The latest build is better at avoiding cutting off text.

The converter automatically tries to avoid breaking text lines but it is not always possible if you have multiple columns of text that are not aligned. In that case it's possible that no matter where you break the page, some text will be cut off.

Thanks


I do not have the latest build, good catch. I am running 2.0.24.2 downloading new version now and hopefully it will fix the issue.
Posted: Friday, April 29, 2011 4:04:49 PM
Rank: Member
Groups: Member

Joined: 4/20/2011
Posts: 19
eo_support wrote:
No. You will have to call ConvertHtml or ConvertUrl multiple times for that.


Ok it was a long stretch so I thought I would ask.
Posted: Friday, April 29, 2011 4:08:35 PM
Rank: Member
Groups: Member

Joined: 4/20/2011
Posts: 19
Is there a way to use images in the header when using the above method or when using the HtmlToPdf.Options.HeaderHtmlFormat? I tried putting the standard html img tag with src=exact location but the image did not show in the header.
eo_support
Posted: Friday, April 29, 2011 4:46:31 PM
Rank: Administration
Groups: Administration

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

Yes. You can use images in both ways (HeaderHtmlFormat or AfterRenderPage). The only difference between rendering header and content is their location.

Thanks
Posted: Friday, April 29, 2011 5:20:50 PM
Rank: Member
Groups: Member

Joined: 4/20/2011
Posts: 19
Any pointers on doing this? Ive tried a couple different ways and it didnt work. looked at the example demo and didnt see anything that hit me square in the head... it is late on a friday so that might have something to do with it, or over looking it.
eo_support
Posted: Saturday, April 30, 2011 8:56:57 AM
Rank: Administration
Groups: Administration

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

We go to our demo app -> HTML to PDF -> Basic -> Header & Footer, then enter <img src="http://www.essentialobjects.com/images/logo.gif" /> in the "Header Format" section. That would render our logo images correctly in the header section --- There really isn't anything special as to the header. In fact the converter just makes another ConvertHtml call with different location settings.

Thanks
Posted: Monday, May 2, 2011 10:33:26 AM
Rank: Member
Groups: Member

Joined: 4/20/2011
Posts: 19
I apologize I should have been clearer, I have the HtmlToPdf.Options.HeaderHtmlFormat working correctly with my images, however where im having some issues is on the second page header using the AfterRenderpage event. In the ACM render it is adding text, so of course when I insert the html code it just displays the html code. Is there a different option to use in the render to convert the "text" to html on the display?
eo_support
Posted: Monday, May 2, 2011 10:39:08 AM
Rank: Administration
Groups: Administration

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

"HTML to PDF" and "ACM" are two different interfaces. Only "HTML to PDF" interface recognizes HTML. So you wish to render HTML, you need to call HtmlToPdf.ConvertHtml (or ConvertUrl if you wish to pull a Url).

You can get the current page object from your AfterRenderPage event handler arguments and then pass the page object to ConvertHtml. Also make sure you set HtmlToPdf.Options.OutputArea because the default OutputArea is the same as your main output area.

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.