|
Rank: Newbie Groups: Member
Joined: 6/28/2018 Posts: 6
|
Hi Support Team,
I am new to this component and we purchansed the tool last week to convert aspx to PDF.
The problem i am facing is , most of the contents in aspx page is populated via javascript. whiile converting to pdf using a button click it only shows the headers which is already in aspx page as static texts. it doesnt show the dynamic htmls i have binded using javascript. i can see it properly in the web page, but when converting to pdf it doesnt show. Also i am not seeing background images, banner images etc. In pdf i can see only black font colors and backgrounds. i am using boot strap
Pleas ehelp
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi, If you use ASPXToPDF to render the PDF, the easiest way for you to troubleshoot is to comment out RenderAsPDF call first. After you comment it out, the result will render to screen instead of to PDF. Check if this rendering result is correct. If this render result is wrong, then this has to do with your ASP.NET code and you must fix this first. Once you fix that, uncomment RenderAsPDF and the result should be the same as what was on the screen. If you still have problems after that, you can try to isolate the problem into a test project and send the test project to us. Once we have that we will be happy to investigate further. See here for more details on sending test project to us: https://www.essentialobjects.com/forum/test_project.aspxThanks!
|
|
Rank: Newbie Groups: Member
Joined: 6/28/2018 Posts: 6
|
Hi,
Can you be more specific. I am seeing the page correctly. I have a button in the page and i am rendering the pdf in that button click. But when the pdf is generated it has only the header contents which is static and not the dynamic contents. Also the pdf not taking the styles. is it a problem with the reference url since in aspx page the reference is in relative path. Do we need to give full url in the style references? Pleas ehelp i am stuck
Thanks Janesh
|
|
Rank: Newbie Groups: Member
Joined: 6/28/2018 Posts: 6
|
For security reasons i cant submit the project. Also the code contains internal web service call to populate dynamic page
|
|
Rank: Newbie Groups: Member
Joined: 6/28/2018 Posts: 6
|
Just to update you with my trouble shooting, i can see the contents are not displayed because the content div is display:none in the aspx, but after binding the values i am making it display block from the javascript. and i can see it all good in the page, but converting it to pdf when button clicks it all appears as initial styles with blank content.
as i can see eo is creating an iframe on the load to push the content and then pdf is generated using the iframe. But how can i say eo to create the iframe on my button click since the content is changed during rendition.
Thanks Janesh
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
There are two common causes for such cases: 1. The converter started before your JavaScript code (that dynamically populates contents) since it does not know when your JavaScript code has finished populating contents. The easiest way to avoid such problem is to increase HtmlToPdf.Options.MinLoadWaitTime. Alternatively, you can use manual trigger: https://www.essentialobjects.com/doc/pdf/htmltopdf/trigger.aspx2. The base Url is wrong. ASPXToPDF will automatically populate HtmlToPdf.Options.BaseUrl based on your current Url. This Url can be wrong in some cases if you have intermediate structures that are invisible to the end user (such as load balancer). In that case you can handle ASPXToPDF's BeforeRender event and set HtmlToPdf.Options.BaseUrl to the correct value. Hope this helps. Please let us know if you still have any questions. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 6/28/2018 Posts: 6
|
Thank you again,
IS this applicable to aspx pages as well this is what i am doing
void btnGeneratePDF_Click(object sender, EventArgs e) { EO.Pdf.Runtime.AddLicense("code goes here"); ASPXToPDF1.RenderAsPDF(); }
Because the links says to add below to by javascript
if (window.eoapi && eoapi.isEOPdf()) eoapi.convert();
So do i need to do the able like this
void btnGeneratePDF_Click(object sender, EventArgs e) { EO.Pdf.Runtime.AddLicense("code goes here");
HtmlToPdf.Options.TriggerMode = HtmlToPdfTriggerMode.Manual;
ASPXToPDF1.RenderAsPDF();
}
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Yes. Your code is correct. However make sure you only call eoapi.convert() AFTER you have loaded all your JavaScript binded contents --- this is the whole point of eopai.convert().
|
|
Rank: Newbie Groups: Member
Joined: 6/28/2018 Posts: 6
|
No luck. always my window.eoapi is undefined. Also eoapi also undefined. Please help am stuck
My export button click taking long time showing loading and then a error. Seems like nothing working for me :(
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
What version do you use? eoapi does not exist in early versions.
|
|