When creating PDF files from DOCX or PPTX files CloudConvert can now dynamically change the content. This feature makes it more convenient to create invoices or mass letters dynamically. Technically you set up a DOCX template with placeholders (for example ${name}). While converting the DOCX file to PDF CloudConvert can replace these placeholders with custom values. This even works for tables with a variable amount of rows as the following example shows.


The shown PDF was created using the DOCX template file and these few lines of PHP code:

    "input" => "upload",
    "inputformat" => "docx",
    "outputformat" => "pdf",
    "converteroptions" => [
       "templating" => [
          "name" => "John Smith",
          "address" => "Smithstreet 1",
          "city" => "Smithtown",
          "zip" => "10101",
          "country" => "US",
          "comment" => "Thanks for your business!",
          "date" => "2015-11-24",
          "total" => "160",
          "items" => [
            ["description" => "Nameless product", "price" => "10", "quantity" => "2", "total" => "20"],
            ["description" => "Other product", "price" => "100", "quantity" => "1", "total" => "100"],
            ["description" => "Stuff", "price" => "2", "quantity" => "20", "total" => "40"],
    "file" => fopen('template.docx', 'r'),

Checkout the full Syntax for the placeholders of the new templating feature.

We think this feature is a great step to make CloudConvert even more powerful and we hope you like it!

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>