Welcome Guest Search | Active Topics | Sign In | Register

Header margin renders inconsistently Options
James Rossy
Posted: Wednesday, December 5, 2012 12:37:58 PM
Rank: Newbie
Groups: Member

Joined: 12/5/2012
Posts: 2
Hi support team,

I'm trying to render a PDF with the margins set to 0, and I'm finding that the header section is sometimes misplaced with an empty space above it. Sometimes the PDF is rendered just fine. I'm not sure what triggers the difference.

Here's a snippet of my setup code:

Code: C#
HtmlToPdf.Options.PageSize = PdfPageSizes.Letter;
        HtmlToPdf.Options.OutputArea = new RectangleF(0.0f, 0.0f, 8.5f, 11f);
        HtmlToPdf.Options.JpegQualityLevel = 100;
        HtmlToPdf.Options.PreserveHighResImages = true;
        if ( ! header.IsNullOrEmpty() ) HtmlToPdf.Options.HeaderHtmlFormat = header;
        if ( ! footer.IsNullOrEmpty() ) HtmlToPdf.Options.FooterHtmlFormat = footer;
        HtmlToPdf.ConvertHtml(body, stream);
        return stream.ToArray();


And here are screenshots of the good and bad headers can be found at http://imgur.com/huNzj

What do you suggest?

Thanks!
James
eo_support
Posted: Wednesday, December 5, 2012 12:54:46 PM
Rank: Administration
Groups: Administration

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

Your code looks fine. However I do not see where you set HtmlToPdf.Options.HeaderHtmlPosition. So you might want to check that. The two things that matters to header is HeaderHtmlPosition and HeaderHtmlFormat.

Thanks!
James Rossy
Posted: Thursday, December 6, 2012 10:31:23 AM
Rank: Newbie
Groups: Member

Joined: 12/5/2012
Posts: 2
Setting the HeaderHtmlPosition seems to have solved the problem, 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.