Rank: Member Groups: Member
Joined: 2/23/2022 Posts: 11
|
Good day,
I've received excellent support from EO with improvements in the area of accessibility. One thing we haven't really been able to solve for ourselves is the reading order of PDFs, which is becoming a sore spot for our clients.
We generate documents by rendering the body of the document, sometimes with manual page breaks, sometimes letting them happen naturally, then afterwards, we apply (overlay) headers and footers by iterating over each page and rendering the HTML with absolute positioning. This has worked well. However, because the header and footer are the last elements to be rendered, the reading order as shown in Adobe Acrobat puts them at the end of the list. Ideally, the header would be first, then the body, then the footer.
Reading through the documentation, I see there is an event, AfterRenderPage, that can be utilized where you can add the header and footer, but this event happens after each page is rendered. My feature request is: could there be an event that fires when a page is started, before the body is rendered?
If such an event existed, we could render the header in this event, allow the body to be rendered, then handle the existing event and put the footer in last. That would solve the reading order problem we are facing.
What are your thoughts on the feasibility of this request? Thank you for your consideration.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,474
|
Hi, Have you tried BeforeRenderPage event? https://www.essentialobjects.com/doc/eo.pdf.htmltopdfoptions.beforerenderpage.htmlTechnically it is not an event. But it functions exactly the same way as HtmlToPdfOptions.AfterRenderPage except that it is fired before the main page contents are added to the page. Thanks!
|
Rank: Member Groups: Member
Joined: 2/23/2022 Posts: 11
|
Ha! I guess I should have expected that. I found the documentation for that event in a different section of the docs and started trying it out.
It's pretty promising. If I handle the BeforePageRender event, my header elements appear first in the reading order. Likewise, handling AfterPageRender puts them after the main body.
However, for whatever reason, I can only do Before or After, not both. Is there a technical reason for that? I suppose what I can do is handle the Before event to get my headers first, then apply the footers afterward by iterating through the pages like we used to do both headers and footers.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,474
|
We are not aware of any restrictions on using both BeforePageRender and AfterPageRender. Can you send a sample app to us if you have problems using both? See here for details on sending test project to us: https://www.essentialobjects.com/forum/test_project.aspx
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,474
|
Thanks for the test project. We were able to find out the root cause. This will be fixed in our next build and we will reply again as soon as the new build is available.
|