HTML to PDF converter
Introduction
HTML to PDF converter is a part of the Open Development Framework, which provides conversion from HTML to PDF format.
How it works
caution
Be aware that nodes that will be executing HTML to PDF conversion require more memory than standard configuration. By default, a single node Java process gets 512 MB of heap size defined in the node[X].bat file. It should be increased to 2,000 MB to be sure the conversion works as expected.
At this point, HTML is printed into PDF on the RPA node with the help of Chrome.
- The JAR executable on the RPA node launches Chrome, loads the needed link, saves it to the RPA node, and sends a successful execution message to Control Tower with System.out.
- As it converts the link to a PDF file inside of the RPA node with the help of a specific JAR file that is not a part of the RPA node, the JAR file must be put to S3 storage at the root of the doc-upload bucket.
note
Normally, S3 storage is installed together with the ODF framework, and you do not have to do anything else.
- As the component executes code on a remote RPA node, it must be used inside the
desktoporuniversaldriver type.
How to use
The need of the RPA node means that the starting point of your code must be inside of the <robot> plugin like this.
As a bot config, you need to use the Weblink to PDF converter bot config:
<config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config" scriptlang="groovy">
<required name="report_weblink"/>
<!--
Mandatory parameters:
'report_weblink' - web URL that needs to be printed to PDF
Optional parameters are:
's3_bucket' - S3 bucket where printed PDF will be uploaded
Key stored in com.workfusion.intake.impl.converter.html2pdf.RpaPdfReportGenerator.S3_BUCKET_KEY
's3_folder' - S3 folder where printed PDF will be uploaded
Key stored in com.workfusion.intake.impl.converter.html2pdf.RpaPdfReportGenerator.S3_FOLDER_KEY
-->
<robotics-flow>
<robot driver="universal" close-on-completion="true">
<script></script>
</robot>
</robotics-flow>
<export include-original-data="true">
<single-column name="report_pdf_link" value="${pdfReportLink}"/>
</export>
</config>
After that, the converter will be able to download the JAR to the RPA node and execute it.
With Java, you can just generate the byte array as a result, or send it to S3, while the bot config can upload the result to S3 only.
S3 options
Custom or default S3 storage bucket and path can be used. Using the bot config, you can pass them with optional s3_bucket and
s3_folder input parameters.
With Java, you can use the com.workfusion.intake.impl.converter.html2pdf.PdfReportGenerator\#generatePdfAndUploadToS3(java.lang.String, java.lang.String, java.lang.String) method.
tip
- The default S3 bucket is doc-upload.
- The default folder is html2pdf.
Proxy options
When custom proxy settings are used, you can set them for PDF generation with the help of Bot Sources.