Welcome Guest Search | Active Topics | Sign In | Register

Header, footer, toc questions Options
nikfe
Posted: Tuesday, May 26, 2015 3:47:53 AM
Rank: Member
Groups: Member

Joined: 5/25/2015
Posts: 21
Hi

I am converting html document to pdf and I have some problems with complicated footer / headers. I have idea how to do these but I just want to make sure that there is no better way to do these. Header and footers are mostly html/css defined but feel free to suggest other options too if necesarry.

What I need:
A: Section topic to footer/header (if page 5 has H1 header "Foo" and page 8 has H1 header "Bar" header on 5-7 should include "Foo" and 8+ "Bar"
B: Some elements on footer/header (example page number) should be every second page left or right.
C: I need to set header position to X inch over content.
D: I need also toc with page indexes



On case A and B I think that I should first covert actual content and after that do some manual analyze with HtmlToPdfResult.HtmlDocument and add footer and header somehow afterwards.

Case C has the problem that I want set headers position related to bottom of header. Header position is related to top of element I need to know height of element (and of course I don't know it). Should I somehow render header separately and put it in the document after I know its size?

Best way to work with D is propably this: http://www.essentialobjects.com/forum/postst6063_Page-number-cross-reference-in-table-of-contents.aspx

And of course: how do I can get all these most efficient as possible? Valid answer is too "you just have to render content, analyze it and render more stuff to it" if there is no shortcuts... Please suggest C# over VB on possible examples.
eo_support
Posted: Tuesday, May 26, 2015 4:09:04 PM
Rank: Administration
Groups: Administration

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

Yes. Render the main contents and then render the header and footer is pretty much what you have to do. This is not the most efficient way of doing things but unfortunately it's the only way that will do what you wanted.

I am not exactly sure if I understand your case C. Once you render the main content, you will be able to use the HtmlToPdfResult.HtmlDocument to get the exact position of each element in the main content. You can then calculate your HtmlToPdf.Options.OutputArea based on those values.

Please feel free to let us know if you still have any questions.

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.