Welcome Guest Search | Active Topics | Sign In | Register

Need solution to implement Back to top page functionality from end of each page. Options
Karthick M
Posted: Friday, March 23, 2018 7:30:17 AM
Rank: Member
Groups: Member

Joined: 6/16/2014
Posts: 22
Hi,
EO pdf is used to generate pdf reports from html page, we need solution to implement Back to top page functionality from end of each page.
Indexing has been implemented using href and div id. This is working fine as the table of contents and data is in same html page.
At the end of each page, we are trying to navigate back to Top page/Table of contents. But it’s not possible as the footer and data template are in different html pages.

Footer Template code:
FooterHtmlFormat = "<hr><a href=#bookmark-toc>Back to Top</a><div style = 'text-align:right;font-size:12px;' > " + localizedEncodedPage + " {page_number}</div>";



Data template code:

ConvertHtml(@"<div id='bookmark-toc' class='report-title' style='width:100%;text-align:center;font-size:18px;font-family:Arial;text-align:center'>"
+ this._reportName +
"<br/><span style='font-family:Arial;font-size:11px;'>" +
fromTimeHeader + toTimeHeader + "</span></div><script>if (typeof eoapi != 'undefined') { if (typeof (eoapi) == 'object') { eoapi.convert(); }}</script>", e.Page);
[
eo_support
Posted: Friday, March 23, 2018 4:13:28 PM
Rank: Administration
Groups: Administration

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

You will not be able to use FooterHtmlFormat to do this because you can't navigate from footer to the main contents. The easiest way for you to do this is to convert the main contents first, then convert the "navigator" over the original result. The "navigator" HTML will be something like this:

Code: HTML/ASPX
<!--for the first page-->
<div style="page-break-after:always;">
    <a name="top_1"></a>
    <div style="height:800px"></div>
    <a href="#top_1">go to top</a>
</div>
<!--for the second page-->
<div style="page-break-after:always;">
    <a name="top_2"></a>
    <div style="height:800px"></div>
    <a href="#top_2">go to top</a>
</div>
......and so on......


Your actual code will be something like this:

Code: C#
//Create a new PdfDocument object
PdfDocument doc = new PdfDocument();

//Convert the main content
HtmlToPdf.ConvertHtml(main_content_html, doc);

//Generate your navigator HTML based on how many pages your main contents has
string navigatorHtml = GenerateNavigatorHtml(doc.Pages.Count);

//Output the navigator HTML into the same PdfDocument
HtmlToPdf.ConvertHtml(navigatorHtml, doc);


You may need to set HtmlToPdf.Options.OutputArea before you convert your navigatorHtml so that the HTML will fit into header/footer area. You will also need to adjust the div's height (in the above sample 800px is used). The purpose of that DIV is to push the second link down.

Hope this helps. Please feel free to let us know if you still have any question.

Thanks!
Karthick M
Posted: Thursday, April 19, 2018 5:54:46 AM
Rank: Member
Groups: Member

Joined: 6/16/2014
Posts: 22
Hi

Whether GenerateNavigatorHtml method is a EO pdf method or custom method.
Can you elaborately explain the functionality of GenerateNavigatorHtml method.

Awaiting for your Reply,
Karthick M
eo_support
Posted: Thursday, April 19, 2018 7:35:43 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
This is a method you need to implement in order to generate the HTML similar to the one shown in our previous reply.


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.