PDF

Converts a DOC or DOCX document to PDF.

Beta
POST

Converts a Microsoft Word document (.DOCX or .DOC) file to a PDF document.

This service uses a LibreOffice headless server to perform the conversion, and may not support all features of the original document.

Known discrepancies

  • Some fonts may not be available in the server, and may be substituted by a closest match.
  • Some complex formatting may not be preserved, such as background graphics.

Variables

Variable replacement is supported with various methods:

  • Templated litterals: {{name}}
  • Word variables, as listed in the document metadata: {DOCVARIABLE "name"}

To enable variable replacement as Word variables for your account, please contact the FileForge support.

Request

This endpoint expects a multipart form containing a file.
optionsobjectOptional

Conversion options. This field is required even if empty.

Options

  • templateLiterals: Map of template literals to replace in the document. Template literals should be enclosed in double curly braces, e.g. {{name}}. Variables name can contain alphanumeric characters and hyphens. All variables are case-sensitive. The value for each variable should be a string. If a value of undefined is passed, the variable will not be removed from the document. If you need to remove a variable, pass an empty string as the value.

NB variables should not have surrounding spaces, e.g. {{ name }}.

Example

In the Word document: {{name}} {{nickname}}. was born on {{date}}.

1{
2 "templateLiterals": {
3 "name": "John Doe",
4 "date": "2021-12-31",
5 "nickname": ""
6 }
7}

There will not be an error if a variable is not found in the document, nor if variables found in the document are not in the options.

filefile

Response

This endpoint returns a file.