Welcome Guest Search | Active Topics | Sign In | Register

changing headers while creating document Options
Becky
Posted: Monday, May 28, 2012 4:19:23 PM
Rank: Advanced Member
Groups: Member

Joined: 5/24/2012
Posts: 45
Hi,
I need to have a header on each page corresponding to which section the page is in. The header needs to be 2 lines, right justified and italicized with a line at the bottom of the header from left margin to right margin.

I can convert html to pdf and then find all the sections and then use pdfcreator to render the correct heading based on which section the page is in. But I can only put text in the header, not html, so how do I get the necessary formatting?

Or - I know I can use html for the heading in the after render page event but how do I know where I am in the document? I know which page I am on, but can I find out if there is a new section starting on this page? I have id = "column_leftacross" for all div elements of new headings in the html.

Thanks,
Becky
eo_support
Posted: Monday, May 28, 2012 4:24:15 PM
Rank: Administration
Groups: Administration

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

For those scenarios, you would usually have to do run the main conversion first, then rely on the returned HtmlToPdfResult object to add your headers/footers in a loop. Take a look of HtmlToPdfResult.HtmlDocument property. From that property you can get the location of each HtmlElement (page number, location in that page). You can then generate your header/footer based on that information.

Thanks!
Becky
Posted: Monday, May 28, 2012 4:39:51 PM
Rank: Advanced Member
Groups: Member

Joined: 5/24/2012
Posts: 45
That is what I am doing, running the main conversion, then figuring out which sections start on which pages and using pdfcreator to render the correct heading on the correct page. The problem I have is that the header is not formatting correctly without being able to use html. So I guess I would have to use the information from the first conversion and then create a second document?

It sure would be nice if acm could read html so it could add better formatted headers and/or footers to a document that has already been converted.

Thanks,
Becky
eo_support
Posted: Monday, May 28, 2012 4:45:48 PM
Rank: Administration
Groups: Administration

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

No. You don't need a second document. You can just use ConvertHtml on the same document to create header/footer. Just make sure you pass a PdfPage object instead of a PdfDocument object to your ConvertHtml. You will also need to set HtmlToPdf.Options.OutputArea differently when you output the header/footer. This is in fact very similar to how you use the pdfcreator interface. You basically feed the same paper back to the printer again.

Thanks
Becky
Posted: Monday, May 28, 2012 5:01:27 PM
Rank: Advanced Member
Groups: Member

Joined: 5/24/2012
Posts: 45
Thanks, I have it working now with the html formatted headers and footers.

I appreciate your quick and helpful responses!
Becky


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.