Description

PDF is a library for managing PDF documents.

It provides an easy method of generating a PDF document from an HTML formatted template file.

Examples

Robot Framework


<p>Thank you for the order.</p>
<p>
    <h3>Name: {{name}}</h3>
    email: {{email}}
    zip: {{zip}}
</p>
<br>
<p>{{items}}</p>
*** Settings ***
Library    RPA.PDF

*** Variables ***
${TEMPLATE}    order.template
${PDF}         result.pdf
&{VARS}        name=Robot Generated
...            [email protected]
...            zip=00100
...            items=Item 1, Item 2

*** Tasks ***
Create PDF from HTML template
    Template HTML to PDF   ${TEMPLATE}  ${PDF}  ${VARS}

Python

from RPA.PDF import PDF

p = PDF()
orders = ["item 1", "item 2", "item 3"]
vars = {
    "name": "Robot Process",
    "email": "[email protected]",
    "zip": "00100",
    "items": "<br/>".join(orders),
}
p.template_html_to_pdf("order.template", "order.pdf", vars)

API Documentation

  • Robot Framework API
  • Python module API