LaTeX to PDF Converter using Docker

Last modified by Vincent Massol on 2024/11/11 00:05

cogConvert LaTeX files to PDF, using Docker
TypeJAR
CategoryAPI
Developed by

Vincent Massol, Thomas Mortagne

Active Installs8
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

Generate a PDF by exporting to LaTeX and then using a docker image to perform the conversion to PDF.

Configuration

The following configuration parameters can be provided in xwiki.properties, shown here with default values:

latex 1.18.1+

## Docker image name and tag to use
latex.pdf.docker.imageName = blang/latex:ubuntu

## Command to execute in the docker container to generate the PDF
## Executed twice to have 2 compilation passes, in order to properly generate the Table of Content for example.
latex.pdf.docker.commands = pdflatex -shell-escape index.tex; pdflatex -shell-escape index.tex

If you want to see the execution logs from the dockerCommands used, set the org.xwiki.contrib.latex.internal.pdf logger to the DEBUG level in the Logging Application. For example:

debuglogging.png

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.


The conversion uses Docker and thus you need to have Docker installed on the server machine where XWiki runs.

On some OS you may need to make sure that you have the DOCKER_HOST environment variable defined for the XWiki LaTeX PDF extension to have a working Docker setup.

Dependencies

Dependencies for this extension (org.xwiki.contrib.latex:latex-pdf-docker 1.26):

  • org.xwiki.contrib.latex:latex-pdf-api 1.26
  • com.github.docker-java:docker-java-core 3.3.6
  • com.fasterxml.jackson.core:jackson-annotations 2.14.0
  • com.fasterxml.jackson.core:jackson-databind 2.14.0
  • org.apache.commons:commons-compress 1.22
  • com.github.docker-java:docker-java-transport-httpclient5 3.3.6

Get Connected