Welcome Guest Search | Active Topics | Sign In | Register

Getting EO to work with Vue.js / React Options
Steve
Posted: Wednesday, November 29, 2017 9:37:10 AM
Rank: Newbie
Groups: Member

Joined: 5/21/2013
Posts: 7
Hello,

I have a sort of SPA page on my website that I'd like to be able to export to PDF using ASPXtoPDF (or any EO call that would work at this point). It's a vue.js form that loads some data from an API and renders out. The issue is, when I export to PDF with EO I just get the Loading UI.

I've tried to play with the minwait time and every other setting I could dig through but nothing seems to work.

I am on version 15. Would a newer version have better support for this? What do you guys suggest?

Code: C#
private static void OnBeforeRenderPage(object sender, PdfPageEventArgs e)
{
     // Adds logo to header using AcmBlock
}

PDFHelper.Init();// Adds license key and sets up header/footer methods (added above for example)

HtmlToPdf.Options.BeforeRenderPage = OnBeforeRenderPage;
HtmlToPdf.Options.TriggerMode = HtmlToPdfTriggerMode.Manual;

eoASPXToPDF.RenderAsPDF(fileName);


Then in the javascript after all my ajax calls are done loading data:

Code: JavaScript
eoapi.convert();


What I get is just a hanging and no result ever comes back.

Thanks
Steve
Posted: Wednesday, November 29, 2017 1:34:11 PM
Rank: Newbie
Groups: Member

Joined: 5/21/2013
Posts: 7
I tried using manual trigger mode but that doesn't seem to fire since I am using BeforePageRender to add a header. Has there been a solution to this? The thread I found didn't have one other than removing that event.
eo_support
Posted: Friday, December 1, 2017 2:02:47 PM
Rank: Administration
Groups: Administration

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

The most common cause for such hang is the triggering code is not called. So you may want to debug into your JavaScript code to find out why it has not been called. The simplest option for you to debug your JavaScript code is use the debug console:

https://www.essentialobjects.com/doc/pdf/htmltopdf/js.aspx

You may also want to update to the current version and see if that resolves the issue for you. The current version uses a much more up to date browser engine and it is not uncommon that script code that is designed for a newer version of the browser fails on an older version. Additionally, you can also use the Chromium browser engine's built-in developer console to debug your script code. In order to do that, you would need to call EO.WebBrowser.WebView.ShowDebugUI before you starts the conversion. The code will be something like this:

Code: C#
//Display the debug UI
EO.WebBrowser.WebView.ShowDebugUI();

//Use a long delay so that we can debug it before it's being converted
//If you use manual trigger and your manual trigger is not fired, then
//obviously this line is not needed since the conversion has been delayed
//forever due to the fact that the manual trigger is not fired
HtmlToPdf.Options.MinLoadWaitTime = 1000 * 300;

//Perform the conversion
HtmlToPdf.ConvertUrl("http://www.google.com", result_pdf_file);


The first line will display the debug UI. You will need to keep clicking the "Refresh" button until you see an engine in your engine list. Click the engine to display all WebViews in that engine. You can then select a WebView to debug it.

Note that this feature is only available on newer versions.

Thanks!
Steve
Posted: Tuesday, December 5, 2017 10:02:13 AM
Rank: Newbie
Groups: Member

Joined: 5/21/2013
Posts: 7
Hello, thanks for your reply!

I apologize as I am not familiar with EO.WebBrowser usage too much. I am using this in a web application, should calling ShowDebugUI() just launch something from my web page or is this some sort of control/tool I need to add before I can use it?
eo_support
Posted: Tuesday, December 5, 2017 10:55:47 AM
Rank: Administration
Groups: Administration

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

Ah...sorry I didn't realize that you were using it in a web application. The debug UI will not work in a production ASP.NET environment but you can try it in your development environment. You can call it any time in your application. The first time it is called it will open the debug UI and if you call it again, it won't do anything.

If that does not work, you would need to rely on the debug console feature.

Thanks!
Steve
Posted: Wednesday, December 6, 2017 1:20:06 PM
Rank: Newbie
Groups: Member

Joined: 5/21/2013
Posts: 7
After some playing around I was able to determine that using HtmlToPdf.ConvertUrl works but using eoASPXToPDF.RenderAsPDF() would just hang forever no matter what. Thanks for your help!
eo_support
Posted: Thursday, December 7, 2017 10:36:11 AM
Rank: Administration
Groups: Administration

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

We can't think of anything that can cause that. Can you try to isolate the problem into a test project and send the test project to us? See here for more information about the test project:

https://www.essentialobjects.com/forum/test_project.aspx

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.