Welcome Guest Search | Active Topics | Sign In | Register

reset Html to PDF Conversion Trigger in the same page after content is changed Options
Meir Pechthalt
Posted: Tuesday, May 29, 2018 12:33:31 PM
Rank: Newbie
Groups: Member

Joined: 5/29/2018
Posts: 2
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.
eo_support
Posted: Wednesday, May 30, 2018 4:48:56 PM
Rank: Administration
Groups: Administration

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

This is a very interesting scenario. Currently we do not have any way to reset the conversion trigger. We will look into this and see if we can add it in our next build.

Thanks!
Meir Pechthalt
Posted: Thursday, May 31, 2018 7:58:51 AM
Rank: Newbie
Groups: Member

Joined: 5/29/2018
Posts: 2
Thanks a lot. Is there a time estimate for the next build?
eo_support
Posted: Friday, June 1, 2018 3:21:24 PM
Rank: Administration
Groups: Administration

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

We have posted the new build that added this feature. Now you can reset trigger both from server side and client side:

https://www.essentialobjects.com/doc/eo.pdf.htmltopdfsession.resettrigger.aspx
https://www.essentialobjects.com/doc/jsdoc.public.webengine.eopdf.resettrigger.aspx

You can download it from our download page. Please take a look and let us know how it goes.

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.