Welcome Guest Search | Active Topics | Sign In | Register

HtmlToPdf Manual TriggerMode not being fired by eopdf.convert() Options
Matt Scott
Posted: Friday, October 3, 2014 4:36:42 AM
Rank: Member
Groups: Member

Joined: 10/3/2014
Posts: 14
I'm using the EO.PDF.DLL version 6.0.18.2.

I have the TriggerMode set to Manual and are calling eopdf.convert() from the JavaScript (I know it is called because I have removed the check to see if it is an object and I get an error when viewing in FireBug).
However, the PDF is not triggered and it is just left hanging, presumably waiting for the JS call.

I have tried both saving the file and outputting the response stream, neither of which makes any difference.

This also occurs in Dual Mode but Automatic seems to work fine.

Please advise & thanks in advance.


eo_support
Posted: Friday, October 3, 2014 1:24:15 PM
Rank: Administration
Groups: Administration

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

The only case that can cause such problem is when eopdf.convert() is not called. There are two things we would suggest:

1. Debug the code in Google Chrome browser instead of FireBug. Our converter is based on WebKit, this is the same engine that Chrome is based on. So it's possible that your JavaScript code runs through different code paths for FireFox and Chrome and only reaches eopdf.convert in FireFox;

2. Use our debug console feature to add trace information:

http://www.essentialobjects.com/doc/4/htmltopdf/js.aspx

This should help you find out why eopdf.convert() is not called.

Thanks!
Matt Scott
Posted: Thursday, October 9, 2014 11:34:51 AM
Rank: Member
Groups: Member

Joined: 10/3/2014
Posts: 14
Hi, I'm having trouble making use of the debug console.
Do you have any examples of this being used?
So are all I have seen is the implementation of this.
Because it is the manual trigger i am testing I see no error log as it just goes indefinitely.
I added a maximum wait time however that just causes the time-out, with no obvious error logs.

I have made a very simple page and tried PDFing that, but still no luck;

<h2>PDFTEST</h2>
<script type="text/javascript">
eopdf.convert();
</script>
Matt Scott
Posted: Thursday, October 9, 2014 11:59:02 AM
Rank: Member
Groups: Member

Joined: 10/3/2014
Posts: 14
UPDATE: I am actually on 5.0.80.2, though I tried the latest DLL which appeared to make no difference.
eo_support
Posted: Thursday, October 9, 2014 4:28:50 PM
Rank: Administration
Groups: Administration

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

Your code is correct. We have verified it here and it works fine.

Please check whether you have HtmlToPdf.Options.NoScript set to true. If you have that property set to true, then JavaScript in your page will not run at all.

Thanks!

Matt Scott
Posted: Thursday, October 9, 2014 4:50:06 PM
Rank: Member
Groups: Member

Joined: 10/3/2014
Posts: 14
Hi, no script is definitely off.
Do we need any JavaScript files included?
I've had a look at the examples and I cannot see why it would not trigger.
Do you have any examples of how to use the debug console in practice?
And does manual mode work in the version we have?
Thanks in advance!
eo_support
Posted: Thursday, October 9, 2014 5:38:21 PM
Rank: Administration
Groups: Administration

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

We are not sure what else to tell you. We have tested your file by following these steps:

1. Save the the code you posted above into a HTML file:

Code: HTML/ASPX
<h2>PDFTEST</h2>
<script type="text/javascript">
eopdf.convert();
</script>


2. Download and install the latest build from our download page;
3. Use Visual Studio to open EOPdfDemo sample project;
4. Add the following code before ConvertUrl call inside Demos\HtmlToPdf\Basic\ConvertUrl.cs:

Code: C#
HtmlToPdf.Options.TriggerMode = HtmlToPdfTriggerMode.Manual;


5. Run the app, then go to All Demos -> Basic -> Convert Url, enter the full path of the file created in step 1;

This works fine with us. So you may want to follow these steps and see if it works for you.

Thanks!
Matt Scott
Posted: Thursday, October 9, 2014 5:58:16 PM
Rank: Member
Groups: Member

Joined: 10/3/2014
Posts: 14
Could it be because we are using eo.pdf in an MVC application?
We are not using it strictly in MVC mode as we simply have a service that we pass a URL to.
As mentioned this method works fine in automatic mode.
eo_support
Posted: Thursday, October 9, 2014 6:14:25 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
No. It should not have anything to do with MVC.
Matt Scott
Posted: Friday, October 10, 2014 4:53:49 AM
Rank: Member
Groups: Member

Joined: 10/3/2014
Posts: 14
Do you have any examples of how to use your debug console please?
All I get when I output it to string is "System.IO.StringWriter + TextWriter".
Matt Scott
Posted: Friday, October 10, 2014 8:07:30 AM
Rank: Member
Groups: Member

Joined: 10/3/2014
Posts: 14
UPDATE : I have found out what the issue is.
If using manual or dual trigger mode, and using AfterRenderPage or BeforeRenderPage (which we were using the ConvertHTML option to add our product logo) the PDF times out there.
When i removed the ConvertHTML call within either AfterRenderPage or BeforeRenderPage, the manual trigger worked correctly.
I have tried this on both 5.0.80.2 and 6.0.18.2 and the effect is the same.
eo_support
Posted: Friday, October 10, 2014 11:00:04 AM
Rank: Administration
Groups: Administration

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

Thanks for the update. That makes perfect sense. The ConvertHTML call inside BeforeRenderPage/AfterRenderPage inherits the trigger settings from the parent conversion. So if you do not call eopdf.convert() inside the HTML you pass to ConvertHTML, then that call will timeout, which in turn causes the parent conversion to times out.

To resolve the issue, you can set HtmlToPdf.Options.TriggerMode to Auto inside your BeforeRenderPage/AfterRenderPage handler. This will set the local value of HtmlToPdf.Options.TriggerMode and it will only affect the calls inside BeforeRenderPage/AfterRenderPage. It will not affect the parent conversion.

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.