Gretyl's Portal

Heretto Help

Show Page Sections

Develop a PDF Generator Template Locally

You can develop a Heretto PDF Generator template on Windows , macOS, and Linux.

In Heretto CCMS, do the following:
  1. In the top-left corner, click the Main Menu and go to PDF Generator.
  2. Do any of the following:
  3. In the right panel, enable the document preview:
    1. Click Select map to preview.
    2. In the Select Map window, select a map.
    3. Click Select.
      Tip:

      When you change the code, to refresh the preview, click Generate PDF.

  4. In the right pane, from the HTML tab, copy the HTML code.
Locally, develop a template by doing the following:
  1. Create a directory for the template development.
    Create a directory on your desktop:
    • C:\Users\user_name\Desktop\PDFGen (Windows)
    • /Users/user_name/Desktop/PDFGen (Mac)

    Where user_name is your user name.

    Tip: If you need version control, you can keep the template files in a Git repository or other source control environment.
  2. In the template development directory that you created in 5, create and edit the testing.html file.
    PDFGen/
    |- testing.html
  3. Paste the HTML code that you copied in 4 to the testing.html file.
  4. In the template development directory that you created in 5, create a testing.css file.
    PDFGen/
    |- testing.html
    |- testing.css
  5. Develop the template in the testing.css file.
Locally, preview the template by doing the following:
  1. Open the shell application by doing one of the following:
    • For Windows, press the Start key and enter cmd
    • For macOS, press Cmd > Space and enter terminal
    • For Linux (Ubuntu 19.10), press the Super key and enter terminal
  2. At the prompt, navigate to the template development directory by entering cd templates_development
    Where templates_development is the directory that you created in 5.
    Enter:
    • C:\Users\user_name\Desktop\PDFGen (Windows)
    • /Users/user_name/Desktop/PDFGen (Mac)

    Where user_name is your user name.

  3. Depending on your operating system, perform one of the following actions:
    • For macOS and Linux, enter prince testing.html -s testing.css
    • For Windows, enter "C:\Program Files (x86)\Prince\engine\bin\prince.exe" testing.html -s testing.css
      Important: The command for Windows assumes that you used the default settings during the Prince installation. If you selected a different Prince installation path, modify the command accordingly.
      Tip: For Windows, you can add C:\Program Files (x86)\Prince\engine\bin\ as a system path environment variable. This way, you will be able to run Prince by entering prince in the command line instead of entering "C:\Program Files (x86)\Prince\engine\bin\prince.exe".

      For more information, see Add the Prince Path to the Windows System Environment Variables.

The locally-generated PDFs may include a Prince watermark (top-right corner).

Figure 1. Locally Generated PDF Example
local prince publishing

Move a Local Heretto PDF Generator template to Heretto CCMS

You move a local Heretto PDF Generator template to Heretto CCMS to make the template available in the publishing interface.

  1. Develop a Heretto PDF Generator template locally. See Develop a PDF Generator Template Locally.
  2. From the testing.css file that you developed locally, copy the CSS code.
  1. In the top-left corner, click the Main Menu and go to PDF Generator.
  2. Do any of the following:
  3. In the left pane, in the CSS tab, paste the CSS code that you copied from the testing.css file.
  4. Click Save Scenario.
  • Publish a map by using the template.

Add the Prince Path to the Windows System Environment Variables

You add the Prince Path to the system environment variables to easily run Prince from the Windows Command Prompt.
Important: This procedure is only applicable for Windows. You do not need to perform this procedure on macOS or Linux.
  1. Click Start and enter environment variables.
  2. Select Edit the system environment variables.
  3. In the System Properties window, click Environment Variables.
  4. In the Environment Variables window, under System variables, double-click Path.
    path variable
  5. In the Edit environment variable window, click New.
  6. Enter "C:\Program Files (x86)\Prince\engine\bin\"
    Important: This assumes that you used the default settings during the Prince installation. If you selected a different Prince installation path, enter the relevant path.
    prince engine variable
  7. In each window, click OK.
You can run Prince by entering prince in the Command Prompt now.

The following example shows that you can enter prince command to run Prince instead of the longish "C:\Program Files (x86)\Prince\engine\bin\" command.

prince command prompt