|
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
|
|
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!
|
|
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?
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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.
|
|
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
|
|
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?
|
|
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
|
|