An Antora extension that converts attachments in an office format (by default, files with a .docx extension) to PDF before publishing.
Much like AsciiDoc files (.adoc) are converted to HTML (.html) by Antora, you can use this extension to do a similar conversion with attachments.
References to the converted PDF should be expressed as a reference to the source file (i.e., the xref should point to the .docx source file rather than the .pdf published file).
During the contentClassified
event, this extension iterates over all attachments in a word processor format (by default, .docx) and uses the libreoffice command (LibreOffice in server mode) on Linux or docto.exe command (Microsoft Office via DocTo) on Windows to convert each file to PDF.
The extension can be configured to process other office document formats as well, such as .doc, .odt, .rtf., .xlsx, .pptx, etc.
$ npx --package antora --package @opendevise/antora-office-to-pdf-extension \
--extension @opendevise/antora-office-to-pdf-extension antora-playbook.yml
The extension supports the following configuration keys:
Name | Type | Default | Description |
---|---|---|---|
batch_size | Integer | 150 | The maximum number of files to convert in a single call to the office application. Use 0 for no limit. NOTE: Actual batch size may be smaller when there are multiple document formats in a batch since each office application must be run separately. |
command | Command name or file path (String) | libreoffice on Linux ./docto.exe on Windows |
The program command (i.e., base call) to use to convert office files to PDF. Use a map with the keys linux and windows to specify a command per operating system. On Windows, the value libreoffice will be replaced with C:\Program Files\LibreOffice\program\soffice.exe. |
extensions | String[] | ['.docx'] |
A list of file extensions to use to filter files to process. Supported file extensions: .doc, .docx, .odt, .rtf, .xls, .xlsx, .ods, .ppt, .pptx, .odp |
skip_files_libreoffice | String[] | [] |
A list of files to skip when converting files using libreoffice. Each entry is in the form <version>@<component>-<module>-<relative> , with all occurrences of / replaced with -. If version is empty, the <version>@ prefix is dropped. |
Copyright (C) 2025-present OpenDevise Inc. and the Antora Project.
Use of this software is granted under the terms of the Mozilla Public License Version 2.0 (MPL-2.0).