Hello EO Support!
I use EO.Pdf to convert a web-page view of a large report to PDF.
the report is divided into sections and each section is presented when a button for that section (tab) is clicked.
in addition, the URL contains route params that point to the current selected tab as well as give the ability to load the page directly into a specific tab.
My first approach was to reload the page for every tab. Pseudo code:
Code: C#
PdfDocument getPdf() {
string[] tabs = {"tab1", "tab2" ...};
string url = ...; //page url
HtmlToPdf.Options.TriggerMode = HtmlToPdfTriggerMode.Manual;
PdfDocument doc = new PdfDocument();
for(int i = 0; i < tabs.length; i++) {
var currentTab = tabs[i];
HtmlToPdf.ConvertUrl(url + currentTab, doc);
}
return doc;
}
and in the JavaScript code of the web-page:
Code: JavaScript
function onTabLoadSuccess() {
if (typeof window.eoapi === 'object') { eoapi.convert(); }
}
The problem with that approach was that the page load time is approximately 6 seconds and I had to load the whole page for every tab, causing the conversion to be significantly slower.
I tried to use HtmlToPdfSession.LoadUrl once, and loop through tabs by clicking on currentTab's button with session.ExecScript.
the problem is: while in the first time the conversion began only after the eoapi.convert() call, in the other times the conversion began immediately which led to empty pages since the content on the page was not ready.
My question is: How can i reset the trigger so I could use it again to trigger conversion on the next tab only when it will be ready?
thanks in advance for your reply.