Tools to Capture and Convert the Web
GrabzIt's Online Community

HTML to DocX returns file but HTML to PDF is not

Ask questions on how to capture or convert web pages or HTML into images, CSV, PDF or DOCX documents as well on how to convert videos into animated GIF's using our API.

When we run the docx generator we get a file back  ie

var HTML = document.querySelector('#' + $parameters.SectionId).innerHTML;

GrabzIt("XXXXXXXXXXXX").ConvertHTML(HTML, {"filename": $parameters.OutputFileName,"format": "docx"}).Create();

however when we run 

var HTML = document.querySelector('#' + $parameters.SectionId).innerHTML;

GrabzIt("XXXXXXXX").ConvertHTML(HTML, {"format": "pdf"}).Create();

we never recieve a file back.

We know that the HTML works as we have cut and paste into the demo box on the website.  Not sure if the demo is Javascript though ie could the javascript PDF generator be broken?   

 

 

Asked by anonymous on the 30th of August 2022

It sounds like there maybe a problem with the JavaScript please can you check here to see if it is being successfully generated.

If it is please check developer tools to see if there are any errors.

If you can email us the HTML you are using we can try it ourselves.

Answered by GrabzIt Support on the 30th of August 2022

Hi,

Thanks for the response.  I have had a look in the diagnostic tool you pointed to and teh file is showing as successfully generated there. So it looks like it isn't being brought back to the browser as a download.  I'm using the latest version of edge.

Answered by anonymous on the 30th of August 2022

You need to look in developer tools in the browser to see what's happening: https://www.ibm.com/docs/en/rpa/21.0?topic=tools-opening-developer-in-microsoft-edge-browser

Answered by GrabzIt Support on the 30th of August 2022

We are also seeing the same issue with PDF not being returned to browser on Chrome so not a unique Edge issue

Answered by anonymous on the 30th of August 2022

I have just tried the convrting HTML to PDF and its working fine. The problem is you are not specifying the download property as shown here.

If the download property is not specified the PDF is displayed in the page. This is not possible for a DOCX so it is just downloaded. 

Answered by GrabzIt Support on the 30th of August 2022

Superstar!  The download parameter was the trick.  Thanks for the help

Answered by anonymous on the 30th of August 2022