General JSON to PDF Template v2
General General JSON to PDF Template v2
This general template converts JSON to PDF while controlling the content and layout from the JSON using LaTeX commands to style the document. This version allows for control of paper size.
Info
Information to call the General JSON to PDF Template v2
API End Point:
https://api.advicement.io/v1/templates/pub-general-json-to-pdf-template-v2/compile
Authentication:
Use your API Security Token (which is generated in your dashboard) in the Adv-Security-Token header parameter
Refer to our authentication guide for more information.
Uses Luatex:
FALSE
Uses Charts:
FALSE
Available On:

General JSON to PDF Template

A JSON to PDF template that creates a PDF document using JSON as both the data source and layout can be a powerful tool for generating dynamic documents. In this approach, the JSON file contains both the data and the layout information (including papaer size), which can be used to generate a PDF document on the fly.

Use Cases for JSON to PDF Conversion

  1. Customized reports: You can use a JSON to PDF template to generate customized reports based on user input. The JSON file would contain information such as the user's name, the date range for the report, and any filters or criteria, while the layout information would specify the report format and structure.
  2. Dynamic forms: You can use a JSON to PDF template to generate dynamic forms based on user input. The JSON file would contain information such as the form fields, their data types, and any validation rules, while the layout information would specify the form layout and styling.
  3. Product catalogs: You can use a JSON to PDF template to generate product catalogs based on a database of products. The JSON file would contain information such as the product name, description, price, and image URL, while the layout information would specify the catalog layout and formatting.
  4. Event programs: You can use a JSON to PDF template to generate event programs based on a schedule of events. The JSON file would contain information such as the event name, time, location, and description, while the layout information would specify the program layout and design.

Key Takeaways

Overall, a JSON to PDF template that uses JSON for both data and layout can be a flexible and powerful tool for generating dynamic documents that can be customized based on user input or data from external sources.

{ "documentSettings": { "font": "roboto", "fontSize": 8, "primaryHEXColour": "343D49", "secondaryHEXColour": "0dbb72", "textHEXColour": "444444", "documentName": "General JSON to PDF Template from ADVICEment", "topMargin": "-0.1cm", "rightMargin": "1cm", "bottomMargin": "-0.1cm", "leftMargin": "1cm", "headheight": "3.13cm", "headsep": "0.5cm", "footskip": "1.5cm", "paperHeight": "210mm", "paperWidth": "297mm", "includehead": true, "includefoot": true, "showframe": true, "header": { "headerLine": false, "leftContent": "", "centerContent": "\\begin{tikzpicture}[remember picture,overlay] \\node at ([xshift=0.00cm, yshift=-1.5cm]current page.north) {\\bfseries\\color{black}\\Huge{HEADER}}; \\end{tikzpicture}", "rightContent": "", "adjustMargin": "1cm" }, "footer": { "footerLine": false, "leftContent": "", "centerContent": "\\begin{tikzpicture}[remember picture,overlay] \\node at ([xshift=0.00cm, yshift=0.75cm]current page.south) {\\bfseries\\color{black}\\Huge{FOOTER}}; \\end{tikzpicture}", "rightContent": "", "adjustMargin": "1cm" }, "latexPreamble": "\\definecolor{Blue}{HTML}{00FFFF}" }, "documentContent": { "content": [ { "type": "latex", "content": "\\begin{tikzpicture}[remember picture,overlay] \\node at ([xshift=0.00cm, yshift=0.0cm]current page) {\\bfseries\\color{black}\\Huge{CONTENT}}; \\end{tikzpicture}", "order": 1 } ] } }

documentSettings - A JSON object which contains the settings of the template (primaryHEXColour, secondaryHEXColour, textHEXColour, font, documentName, logo, logoType, logoWidth, margins, headSep, footSkip, showframe, header, footer).

font - An optional string which contains the font of the document. Possible options are: 'helvetica', 'avant garde', 'sans serif', 'charter', 'open sans', 'bera', 'venturis', 'raleway', 'overlock', 'roboto', 'spectral', 'clear sans', 'noto sans', 'noto mono', 'josefin', 'bera sans', 'latin modern', 'theano modern', 'droid sans', 'fira sans', 'XCharter', 'bookman', 'gyre bonum', 'gyre schola', 'gyre termes'.

fontSize - An optional integer which contains the font size of the document. Possible options are: 8, 9, 10, 11, 12, 14.

primaryHEXColour - An optional string which contains the primary font colour of the document.

secondaryHEXColour - An optional string which contains the secondary font colour of the document.

textHEXColour - An optional string which contains the text font colour of the document.

documentName - An optional string for the name of the document.

topMargin - An optional string containing the top margin size (in cm).

rightMargin - An optional string containing the right margin size (in cm).

bottomMargin - An optional string containing the bottom margin size (in cm).

leftMargin - An optional string containing the left margin size (in cm).

headheight - An optional string relating to the height of the header (in cm). See LaTeX geometry package documentation for more information on this parameter.

headSep - An optional string relating to the space between the header and the beginning of the document (in cm). See LaTeX geometry package documentation for more information on this parameter.

footSkip - An optional string relating to the space between the end of the document and the footer (in cm). See LaTeX geometry package documentation for more information on this parameter.

paperHeight - An optional string relating to the height of the paper size (in cm). See LaTeX geometry package documentation for more information on this parameter.

paperWidth - An optional string relating to the width of the paper size (in cm). See LaTeX geometry package documentation for more information on this parameter.

includehead - A boolean expression which determines whether the header is part of the top margin (false) or below it (true).

includehead - A boolean expression which determines whether the footer is part of the bottom margin (false) or below it (true).

showFrame - A boolean expression (true/false) to show the frame of the document.

header - An object containing settings to control the header.

headerLine - A boolean expression that generates a horizontal line between the header and the beginning of the document.

leftContent - The content that appears on the left-hand side of the header. Can contain LaTeX commands, text or simply 'logo'.

centreContent - The content that appears in the centre of the header. Can contain LaTeX commands, text or simply 'logo'.

rightContent - The content that appears of the right-hand side of the header. Can contain LaTeX commands, text or simply 'logo'.

adjustMargin - An optional string containing whether the header margin needs to be adjusted sideways (in cm).

footer - An object containing settings to control the footer.

footerLine - A boolean expression that generates a horizontal line between the footer and the end of the document.

leftContent - The content that appears on the left-hand side of the footer. Can contain LaTeX commands, text or simply 'logo'.

centreContent - The content that appears in the centre of the footer. Can contain LaTeX commands, text or simply 'logo'.

rightContent - The content that appears of the right-hand side of the footer. Can contain LaTeX commands, text or simply 'logo'.

adjustMargin - An optional string containing whether the header margin needs to be adjusted sideways (in cm).

latexPreamble - Contains custom LaTeX commands which will be inserted before '\begin{document}'.

documentContent - A JSON object which contains the content of the template (firstPageLeftColumn, firstPageRightColumn and other data for charts and tables).

content - A required object which contains the data for the right column on the first page.

type - A required string which contains the type of text for the body of the document. Possible options are: 'heading', 'section', 'subsection', 'paragraph', 'newpage', 'enumerate', 'itemize', 'table'.

content - A required string or array of strings which contains the text for the body of the document. Can contain LaTeX commands. Note that in an event of a table, this contains the key-name for the table.

order - A required number which determines the order of the text.

height - An optional parameter controling the height of the chart.

width - An optional parameter controling the width of the chart.