Creating a PDF from an AsciiDoc file
Create PDF from an AsciiDoc file directly in the IDE.
How it works
The user can choose Create PDF from current file from the editor’s action toolbar to convert the file shown in the current AsciiDoc editor to a PDF using Asciidoctor PDF.
If creation of the PDF file succeeds, the plugin opens the PDF in the system’s PDF viewer. To find out more how to configure the output and formatting, visit https://docs.asciidoctor.org/pdf-converter/latest/convert-to-pdf/.
On Windows, users need to close the PDF viewer first to be able to create a new instance of the PDF as the file would otherwise be locked.
Version of Asciidoctor PDF
The plugin uses Asciidoctor PDF version 2.3. To find out about the exact version of Asciidoctor PDF used in the plugin a user has installed, create a minimal PDF and look at the document properties as shown in the PDF viewer. The application property shows the exact version of Asciidoctor PDF used to create the document.
A full history of the different versions of Asciidoctor PDF included in each plugin version is available in the changelog of the plugin.
Downloading Asciidoctor PDF support
Asciidoctor PDF is not included in the plugin as default as it adds approximately 2 MB to the download of the installation and each update.
When creating a PDF for the first time, the plugin will download the necessary dependency.
The download requires a working internet connection. When the download fails, the IDE prompts to check proxy settings or to retry the download. The IDE’s event log contains instructions for a manual download of the file.
The dependencies will be cached locally. A new download will only be necessary when the AsciiDoc plugin requires a newer version.
Users can force the download by selecting “Download AsciiDoc dependencies for diagrams and PDF creation” in the settings of the plugin.
Using a PDF theme
The plugin doesn’t offer a command-line option like --theme.
Instead, set the document attributes pdf-theme and pdf-themesdir in the document or in an .asciidoctorconfig file.
Always specify an absolute directory for pdf-themesdir.
Use modules/ROOT/pages/features/advanced as a prefix for a folder relative to the current document, or {asciidoctorconfigdir} for a folder relative to the .asciidoctorconfig file.
:pdf-themesdir: {docdir}/themes
:pdf-theme: custom
This will use the file themes/custom-theme.yml.
A PDF theme only applies when creating a PDF using Create PDF from current file. The preview shows the document as HTML and ignores the PDF theme. To change the look of the preview, use a custom stylesheet instead.
Non-latin languages and extra fonts
There is a separate chapter on how to enable Non-latin languages and extra fonts when creating PDFs with AsciiDoc and this plugin.