Skip to main content
Version: 7.x

PDF Engines

The PDF Engines module gathers all engines that can manipulate PDF files.

info

It calls each engine until one successfully handles a task.

Properties

--pdfengines-engines        strings  Set the PDF engines and their order - all by default
--pdfengines-disable-routes bool Disable the routes
--unoconv-disable-listener bool Do not start a unoconv listener - save resources in detriment of performance
tip

If you don't need all PDF engines, you may select only those you're interested in.

For instance --pdfengines-engines=pdftk,unoconv-pdfengine selects PDFtk as the first engine, and unoconv as the second.

Routes

Each route accepts multipart/form-data requests.

Merge

POST /forms/pdfengines/merge

This route accepts PDF files and merges them alphabetically.

For instance:

curl \
--request POST 'http://localhost:3000/forms/pdfengines/merge' \
--form 'files=@"/path/to/pdf1.pdf"' \
--form 'files=@"/path/to/pdf2.pdf"' \
--form 'files=@"/path/to/pdf3.pdf"' \
--form 'files=@"/path/to/pdf4.pdf"' \
-o my.pdf
pdfFormat string  The PDF format of the resulting PDF

For instance:

curl \
--request POST 'http://localhost:3000/forms/pdfengines/merge' \
--form 'files=@"/path/to/pdf1.pdf"' \
--form 'files=@"/path/to/pdf2.pdf"' \
--form 'files=@"/path/to/pdf3.pdf"' \
--form 'files=@"/path/to/pdf4.pdf"' \
--form 'pdfFormat="PDF/A-1a"' \
-o my.pdf
info

After a merge, the PDF engines will convert the resulting PDF to a specific format.

Check the available PDF formats:

Convert

POST /forms/pdfengines/convert

This route accepts PDF files and a form field pdfFormat for converting them into the specified format.

For instance:

curl \
--request POST 'http://localhost:3000/forms/pdfengines/convert' \
--form 'files=@"/path/to/pdf1.pdf"' \
--form 'files=@"/path/to/pdf2.pdf"' \
--form 'files=@"/path/to/pdf3.pdf"' \
--form 'files=@"/path/to/pdf4.pdf"' \
--form 'pdfFormat="PDF/A-1a"' \
-o my.zip

Engines

PDFtk

  • Module name: pdftk
  • ✅ Merge
  • ❌ Convert

This engine uses PDFtk - give it a star ⭐️

PDFcpu

  • Module name: pdfcpu
  • ✅ Merge
  • ❌ Convert

This engine uses PDFcpu - give it a star ⭐️

QPDF

  • Module name: qpdf
  • ✅ Merge
  • ❌ Convert

This engine uses QPDF - give it a star ⭐️

unoconv

  • Module name: unoconv-pdfengine
  • ❌ Merge
  • ✅ Convert (format PDF/A-1a)

This engine uses unoconv - give it a star ⭐️

Metrics

The PDF Engines module exposes the following metrics:

  • {namespace}_pdftk_active_instances_count - current number of active PDFtk instances.
  • {namespace}_qpdf_active_instances_count - current number of active QPDF instances.
  • {namespace}_unoconv_active_instances_count - current number of active unoconv instances.
  • {namespace}_unoconv_listener_active_instances_count - current number of active unoconv listener instances.
  • {namespace}_unoconv_listener_queue_length - current number of processes in the queue.

See Prometheus for more details.