Skip to content

Projects · FZPure suite

FZPureDOCX

DOCX and PDF documents from Word templates. A small PHP server that fills Word templates, replacing placeholders with text, HTML, tables and checkboxes, and returns DOCX or PDF.

Code on GitHub Download the latest release

  • Licence MIT
  • Documentation in English and Italian

The problem

Quotes, contracts, reports: the people who use them want to edit them in Word, the software that produces them wants to fill them in automatically. The usual solutions cost a licence or need software installed on the server.

The idea

The template stays a normal Word file with placeholders. Your application sends it with an HTTP POST request together with the data, and gets back a JSON response with the filled document, as DOCX and/or PDF. The PDF comes from LibreOffice when it is installed, otherwise from the bundled pure-PHP converter.

At a glance

  • No external libraries and no licences to buy.
  • Placeholders for text, HTML, headers, repeating table rows, checkboxes.
  • PDF through LibreOffice or in pure PHP, with no external programs.
  • No database; no files are left on the server after a request.
  • Runs on ordinary shared hosting.

How to use it

$post = [
    'apikey'       => 'YOUR_KEY',
    'modello_docx' => base64_encode(file_get_contents('template.docx')),
    'vars'         => ['surname' => 'Smith'],
    'converti_pdf' => 'si',
];
// POST to gdocx.php → JSON with DOCX and PDF in base64
// (API field names are in Italian; the README explains each one)

Requirements: PHP 8.1+ with zip, dom, zlib, mbstring. Apache with .htaccess. LibreOffice optional.

Installation, configuration and the full reference are in the README on GitHub.

Support the project

FZPureDOCX is free and open source. If you find it useful, you can buy me a coffee: it is a simple way to support its development.

☕ Buy me a coffee

Same family

FZPure suite

FZPureHTML

HTML to PDF in pure PHP.

Write your document in HTML with the bundled stylesheet, call one function, get the PDF. Two files to copy to your server.

PHP · MIT · IT/EN

Details Try it Code on GitHub

Follow the projects

New releases, development notes and what I learn along the way.

Follow on GitHub Newsletter (Italian)