How to convert Tex to PDF with a LaTeX API
Tags: tutorial, productivity, showdev, api
Published: 2022-10-18 12:53:42

The modern approach to API development is often associated with the use of the cloud. Therefore, it has become increasingly important to present novel ideas capable of improving users' and developers' digital experiences.

With that in mind, the [DynamicDocs API](https://advicement.io/dynamic-documents-api) approach to PDF generation is to use LaTeX, a language that is designed for high-quality typesetting.

The DynamicDocs API provides an alternative to deploying a stand-alone PDF-generating solution for startups and enterprises. The API approach allows developers to test the solution quickly via Postman and generate large amounts of PDF documents, while incorporating graphics and logic into the templates.

In this article, we present a specific type of [JSON to PDF](https://advicement.io/blog/pdf-generation-made-easy-using-ready-made-templates-and-json-to-pdf-api) template called [TEX to PDF](https://advicement.io/dynamic-documents-api/json-to-pdf-templates?type=tex+to+pdf), which allows users to send their LaTeX source file and compile it via the API.

## What Is LaTeX?

LaTeX is a computer language used for document preparation, specifically PDF generation. LaTeX source files have a Tex extension and are typically compiled into PDFs. Although it is very popular in academia, where it is used for dissertations and journal articles, the language lends itself well to creating great-looking documents in general.

One of its advantages is the separation of document content and the rules governing the look and feel of the document. A notable disadvantage of LaTeX is that the learning curve for writing the rules of the document layout can be steep and require a significant investment in time for the user.

To circumvent this, DynamicDocs API has a library of ready-made PDF to JSON templates that do not require any knowledge of LaTeX. However, this article assumes that you already have a working Tex file that needs to be compiled.

## LaTeX Compilers

To convert LaTeX source files into PDFs, one needs a compiler. DynamicDocs API offers two compilers, namely pdfLaTeX and LuaLaTeX.

Tex to PDF Template range consists of two general templates allowing users to upload their own tex file and optionally include Base64 encoded images in the JSON payload.

The templates correspond to the two compilers available. For more information on calling the two templates, visit [Tex to PDF with pdfLaTeX](https://advicement.io/dynamic-documents-api/json-to-pdf-templates/pub-tex-to-pdf-with-pdflatex-v1) Template and [Tex to PDF with LuaLaTeX](https://advicement.io/dynamic-documents-api/json-to-pdf-templates/pub-tex-to-pdf-with-lualatex-v1) Template.

Let's now look at the case when it makes sense to use TEX to PDF conversion with an API.

## Considerations for TEX to PDF with DynamicDocs API

The following list explains the criteria for when using DynamicDocs API makes sense for TEX to PDF conversion:

- You need to generate several PDF documents and want to do it programmatically.
- You have (or can create) a Tex file that can be adjusted with the dynamic data.
- You can make a POST request to the API with your TeX file formatted as JSON.

If any of those points do not apply to your use case, you will likely be better off using a simple [online Tex to PDF converter](https://www.freefileconvert.com/tex-pdf) or [Overleaf](https://www.overleaf.com/).

## Tutorial to Convert TEX to PDF with DynamicDocs API

Consider a situation where you have to create PDF name tags where the underlying data is stored in the system and can be accessed programmatically. The aim is to create a PDF document that looks as follows:

![Name Tag Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w7552g13tmicqp8fvzqz.png)

To get started with DynamicDocs API, you will need to [sign up](https://advicement.io/sign-up) for an account with ADVICEment. Without needing to give bank card information, the new accounts are automatically set up with a FREE plan which offers a limited number of API calls. Once the account email address is confirmed, users can log in and access the Dashboard, where they can get their account API key.

We are now almost ready to make the API call. To create the PDF document above, we have written the following Tex file:

```
\documentclass[10pt]{article}

\usepackage[paperheight=3in, paperwidth=4in, left=0mm, right=0mm, top=0mm, bottom=0mm, noheadfoot]{geometry}
\usepackage[T1]{fontenc}
\usepackage[sfdefault,lf]{carlito}
\usepackage{graphicx}
\usepackage{ragged2e}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[none]{hyphenat}

%%%%%%%%%%%%%%%%%%%%%%% content definition %%%%%%%%%%%%%%%%%%%%%%%
\makeatletter\let\thetitle\@title\makeatother
\usepackage[pdfencoding=auto,unicode, bookmarks=false, colorlinks=false, pdfborder={0 0 0},pdftitle={Name Tag}, pdfauthor={Advicement}, pdfsubject={Name Tag}, pdfkeywords={Name Tag}]{hyperref}

%%%%%%%%%%%%%%%%%%%%%% color definitions %%%%%%%%%%%%%%%%%%%%%%
\definecolor{White}{HTML}{FFFFFF} 
\definecolor{Black}{HTML}{000000} 
\definecolor{AdvGreen}{HTML}{0DBB72} 
\definecolor{AdvGray}{HTML}{383838}
\definecolor{AdvDarkGray}{HTML}{303030}

\begin{document} 
\pagecolor{White}
\begin{tikzpicture}[remember picture,overlay]
\node (rec1) [rectangle, inner sep=0.0cm, outer sep=0, draw = AdvGreen, anchor=north west, fill = AdvGreen, minimum width = 9.16cm, minimum height = 2cm] at ([xshift=0.5cm, yshift=-0.5cm]current page.north west) {}; 
\node (rec2) [rectangle, inner sep=0.0cm, outer sep=0, draw = AdvGreen, anchor=south west, fill = AdvGreen, minimum width = 9.16cm, minimum height = 0.3cm] at ([xshift=0.5cm, yshift=0.5cm]current page.south west) {}; 
\node (image) [anchor=north] at ([xshift=0cm, yshift=-0.4cm]rec1.north) {\advGetImage{key = image1, width=3.5cm, type = png}}; 
\node (name) [anchor=north, inner sep=0.0cm, outer sep=0] at ([xshift=0cm, yshift=-3.75cm]current page.north) {\color{AdvGreen} \bfseries \Huge{Name}};
\node (rec3) [rectangle, inner sep=0.0cm, outer sep=0, draw = AdvGreen, anchor=north, fill = AdvGreen, minimum width = 1cm, minimum height = 0.01cm] at ([xshift=0.0cm, yshift=-0.25cm]name.south) {}; 
\node (role) [anchor=north, inner sep=0.0cm, outer sep=0] at ([xshift=0cm, yshift=-0.25cm]rec3.north) {\color{AdvGreen} \LARGE{Title}};
\end{tikzpicture} 
\end{document}

```

Changing this Tex file by including different names and titles for each name tag can be done programmatically. Although at first glance, this looks like a normal Tex file, notice the \advGetImage function, which is a custom function used within DynamicDocs API to convert the image from JSON payload and insert it into the file.

Notice that it references the image1 key in the JSON payload below. For more information on this function, visit [DynamicDocs API documentation](https://advicement.io/dynamic-documents-api/documentation/getting-started).

Now, we are ready to formulate our JSON payload, which looks as follows:

```
{
"texFileContent": "\\documentclass[10pt]{article}\n\n\\usepackage[paperheight=3in, paperwidth=4in, left=0mm, right=0mm, top=0mm, bottom=0mm, noheadfoot]{geometry}\n\\usepackage[T1]{fontenc}\n\\usepackage[sfdefault,lf]{carlito}\n\\usepackage{graphicx}\n\\usepackage{ragged2e}\n\\usepackage{xcolor}\n\\usepackage{tikz}\n\\usetikzlibrary{calc}\n\\usepackage[none]{hyphenat}\n\n%%%%%%%%%%%%%%%%%%%%%%% content definition %%%%%%%%%%%%%%%%%%%%%%%\n\\makeatletter\\let\\thetitle\\@title\\makeatother\n\\usepackage[pdfencoding=auto,unicode, bookmarks=false, colorlinks=false, pdfborder={0 0 0},pdftitle={Name Tag}, pdfauthor={Advicement}, pdfsubject={Name Tag}, pdfkeywords={Name Tag}]{hyperref}\n\n%%%%%%%%%%%%%%%%%%%%%% color definitions %%%%%%%%%%%%%%%%%%%%%%\n\\definecolor{White}{HTML}{FFFFFF} \n\\definecolor{Black}{HTML}{000000} \n\\definecolor{AdvGreen}{HTML}{0DBB72} \n\\definecolor{AdvGray}{HTML}{383838}\n\\definecolor{AdvDarkGray}{HTML}{303030}\n\n\\begin{document} \n\\pagecolor{White}\n\\begin{tikzpicture}[remember picture,overlay]\n\\node (rec1) [rectangle, inner sep=0.0cm, outer sep=0, draw = AdvGreen, anchor=north west, fill = AdvGreen, minimum width = 9.16cm, minimum height = 2cm] at ([xshift=0.5cm, yshift=-0.5cm]current page.north west) {}; \n\\node (rec2) [rectangle, inner sep=0.0cm, outer sep=0, draw = AdvGreen, anchor=south west, fill = AdvGreen, minimum width = 9.16cm, minimum height = 0.3cm] at ([xshift=0.5cm, yshift=0.5cm]current page.south west) {}; \n\\node (image) [anchor=north] at ([xshift=0cm, yshift=-0.4cm]rec1.north) {\\advGetImage{key = image1, width=3.5cm, type = png}}; \n\\node (name) [anchor=north, inner sep=0.0cm, outer sep=0] at ([xshift=0cm, yshift=-3.75cm]current page.north) {\\color{AdvGreen} \\bfseries \\Huge{Name}};\n\\node (rec3) [rectangle, inner sep=0.0cm, outer sep=0, draw = AdvGreen, anchor=north, fill = AdvGreen, minimum width = 1cm, minimum height = 0.01cm] at ([xshift=0.0cm, yshift=-0.25cm]name.south) {}; \n\\node (role) [anchor=north, inner sep=0.0cm, outer sep=0] at ([xshift=0cm, yshift=-0.25cm]rec3.north) {\\color{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WMT2g3GkT8VhD4ZBeQLK74wBCoTXLKhXdPg8+xpXzvGbSv2SfPlx1TLE/jcNJy4idbqnFIdQVBWwG17j4V/6Wletb/NDHEAIvEjhhgoPy2/re3B9kQA8G7gRx7+nr8ehIgcnJsCTBfgCAW/54E0XQsb5XK449GQeriYWljznfUgp5571qFGJg90fAvEpsw6mGbou57gblxy4eNTMNRwKOJ1dz02cgkUEmnix3ucAPuvdFRe2GUjeL7TKHwAOQBes5AkI6EoyHIDlTksRENCVULLMAeRCp+UICOhKCD7mCKFvdlqOgIBuhFL/R5xvrv0QwM1OCxMQ0GXMWSntTe7ChQsOgD/utDQBAd0ER+kfXrr0ap4HgOXFG5dHDh+NAuR0pwULCOg85Lvnz73zV0BZN+/kkPYKofhe54QKCOg8FPjzySHlT3a3q2ruj3zlqW9SSv4MwNQ9lSwgoLPc5Cj9zkfn3n29fGfNppSZmTNSOKH/KgfyHAV5CISOIfjvogM+Xxig5A4l9AIB3qDZtTd34nGG/wdeiOyeG+9arQAAAABJRU5ErkJggg=="
}
```

Note that the stringified Tex file has to be put under the texFileContent key in the JSON. Furthermore, the texFileContent value contains double backslashes where single backslashes were previously used in the Tex file.

The double backslashes are a result of stringifying the TEX file. Finally, the JSON contains a Base64 encoded image which is referenced in the \advGetImage function above. This allows users to make images dynamic in the documents.

We are now ready to make the API call and POST the JSON above to TEX to PDF with the pdfLaTeX template endpoint:

`https://api.advicement.io/v1/templates/pub-tex-to-pdf-with-pdflatex-v1/compile`

To do so successfully, you will have to authenticate your API request by including the API key as a header parameter as follows:

> Header Key: **Adv-Security-Token**
> Value: **{Your Account API Key}**

To make the API call above, we suggest using Postman and viewing the [DynamicDocs API – Public Workspace](https://www.postman.com/advicement/workspace/dynamicdocs-api-public-workspace/collection/8428379-a75fccff-226d-4a68-9ea4-4af37c26f126) for a working example.

The response of the API call is a simple JSON with the location of the Status JSON. To see whether the PDF was generated successfully, we can GET the Status JSON using the URL found in the response.

If the PDF is generated successfully, the Status JSON will look as follows and contain the link to download the PDF:

```
{
"id": "47c2451a-8aa8-47eb-b5db-842dc770b53a",
"startedAt": "Tue Oct 09 2022 19:03:57 GMT+0000 (Coordinated Universal Time)",
"statusCode": 201,
"statusDescription": "document created successfully",
"calculationLogUrl": "https://advicement-prod-api-calls.s3.eu-west-1.amazonaws.com/test/blank-template/47c2451a-8aa8-47eb-b5db-842dc770b53a/output/log/calcLog.txt?AWSAccessKeyId=ASIA2L...",
"latexLogUrl": "https://advicement-prod-api-calls.s3.eu-west-1.amazonaws.com/test/blank-template/47c2451a-8aa8-47eb-b5db-842dc770b53a/output/log/inputFile.log?AWSAccessKeyId=ASIA2L...",
"documentUrl": "https://advicement-prod-api-calls.s3.eu-west-1.amazonaws.com/test/blank-template/47c2451a-8aa8-47eb-b5db-842dc770b53a/output/inputFile.pdf?AWSAccessKeyId=ASIA2L..."
}
```

We have completed the LaTeX to PDF process using an API. Of course, the Tex file above can be replaced with any working LaTeX source file. The approach above gives developers a powerful option of creating a large variety of different document types.

## Final Remarks

As outlined in this article, DynamicDocs API caters to a specific use case when doing [TEX to PDF conversion](https://advicement.io/dynamic-documents-api/json-to-pdf-templates?type=tex+to+pdf) (see the Consideration section to see whether your use case fits).

In an event where you have ticked all the conditions, TEX to PDF templates give the option of creating different document types, provided users can create their own working Tex file and dynamically populate it with their data.

DynamicDocs API runs a full TeX Live 2021 Distribution, meaning that users have access to an extensive range of the latest LaTeX packages and fonts. For quick integration, follow the steps above or visit [DynamicDocs API – Public Workspace via Postman](https://www.postman.com/advicement/workspace/dynamicdocs-api-public-workspace/collection/8428379-a75fccff-226d-4a68-9ea4-4af37c26f126) page.