Skip to main content
Skip table of contents

Branding PDF Downloads

Users can download PDFs from Graph View and Map View. SuperWEB2 is supplied with a default template for the downloads, but you can replace this with your own version. You can either use the same PDF template for both graph and map downloads, or use a different template for each.

In order to change the template for PDF downloads, you must create a PDF form containing specific form fields. SuperWEB2 will populate the form fields with the information from the map or graph at download time.

To create the PDF form, you need Adobe Acrobat. This is the full, paid, version of the Adobe Acrobat software, not the free Adobe Reader software (the free version only allows you to view PDFs, not create and edit them).

Create a PDF Template

  1. The first step is to create a basic PDF to use as the template.

    This should include any static items you want to appear in the downloaded file, such as your company logo, branding, and copyright statements.

    You can use whatever tool you like to create the initial document, as long as it can export your document to PDF. For example, you might create the initial document in Microsoft Word:

  2. When you have finished creating your initial template, export the document to PDF.
  3. Open your PDF in Adobe Acrobat.
  4. Choose the option to create a form (the exact option will depend on the version of Acrobat you are using):

    You may be prompted to confirm how to create the form.

    If prompted, choose to create a form From Existing Document:

    And choose to base the form on the Current Document:

    Then choose the option to Add New Field.

  5. Add the following form fields to your document (the field names must match the ones shown here exactly):

    Field NameWill be populated with...Applies to...
    Map

    The graph or map.

    Both map and graph downloads.
    Map TitleThe table name.Both map and graph downloads.
    InformationDetails of what is being counted in the table.Both map and graph downloads.
    Database LabelThe name of the database.Both map and graph downloads.
    LegendThe legend/key for the map.Map downloads only.
    LegendTitleThe value of the Field drop-down list from Map View (i.e. it indicates what field is being visualised on the map).Map downloads only.

    By default, SuperWEB2 is supplied with separate templates for map and graph downloads. This allows for the best use of space in the template, as the graph download template does not need to include the Legend and LegendTitle fields.

    If you want to continue to use different templates then you will need to create two copies of your PDF, one for graph downloads and one for maps.

    If you prefer, you can use a single template for both. If you want to do this the template must include all the form fields listed in the table. The ones that do not apply to graph downloads will simply be left blank when users download a graph.

  6. Position the form fields where you want to items to appear on the page. You will typically want to make the Map field the biggest and most prominent, because this is where the map or graph will be placed in the document.

    For example:

  7. Use the options in Acrobat to set any field properties that you want to apply to your template, such as the font type, font size and text alignment, as well as border and background colours on the form elements (if any). These properties will be applied at download time when SuperWEB2 writes the map/graph contents to the template.

    Make sure that the font type used in your form fields supports the character set of your databases. The sample PDF templates supplied with SuperWEB2 use one of the default Adobe Reader fonts (Helvetica), which supports only Latin characters. If you are using other character sets in your deployment then you will need to replace the supplied PDF templates with your own versions, and choose a suitable font to use in your template.

    If this is the case, you may also need to configure SuperWEB2 to embed your font(s) in the PDF. When fonts are not embedded, PDFs only display correctly if the user opening the PDF has the specific font installed on their computer. See the section on embedding fonts below for more information.

    Make sure the fields are big enough to accommodate the text (such as the table name and details of what is being counted) that is likely to be generated from your tables. If the text strings written to the template by SuperWEB2 are longer than the available space in the field then they will automatically be truncated. 

    Some strategies you can use to increase the number of characters that can be written to the form fields include increasing the size of the field in the PDF template, reducing the font size of the form field, and enabling the multi-line option in the form field properties to allow the text to wrap onto multiple lines (this option is not selected by default; to enable it, right-click the field in Acrobat and select Properties > Options > Multi-line).

    It may not be possible to create a template with fields that are big enough to incorporate the text for every possible table that your users might create (for example if they create very complex tables with extremely long titles). You may need to use some trial and error to settle on a size of form field and font size that provides a good compromise that is flexible enough to support your users while still making good use of the available space.

  8. On your graph template, right-click the Map field and select Properties, then the Position tab.
  9. Make a note of the Width and Height of the Map field in inches. You need these values to tell SuperWEB2 how big to generate the graph image that will be placed in the PDF.
  10. Save your graph template as <tomcat_home>\webapps\webapi\WEB-INF\templates\SWDownloadGraph.pdf and save your map template as <tomcat_home>\webapps\webapi\WEB-INF\templates\SWDownloadMap.pdf

  11. Open <tomcat_home>\webapps\webapi\scripts\sw2-charts\sw2-chart-export-options.js in a text editor.
  12. Edit the values for chartimgsizex and chartimgsizey so that they match the width and height (in inches) of the Map field in your graph template that you obtained from Acrobat. For example:

    CODE
        "pdf": {
            "chartimgsizex": 11.17,
            "chartimgsizey": 5.35,
            "dpi": 72,

    You may also wish to adjust the dpi value. This controls the dots per inch used to render the graph image when creating the PDF. The default is 72dpi, which is standard print resolution.

  13. Save your changes.
  14. You can now test the template by logging in to SuperWEB2 and creating a table, then downloading a graph and map to PDF.

Other PDF Configuration Settings

In addition to changing the template PDF, there are some other configuration settings you can adjust for PDF downloads.

Embedded Fonts

Depending on your PDF template, you may need to configure SuperWEB2 to embed fonts in PDF downloads.

The Adobe Reader application has a set of default fonts (known as the Adobe Base 14 fonts). These fonts are always available and do not need to be embedded. However, if your document uses other fonts then the PDF will only display correctly if users viewing the PDF have those fonts installed on their computers.

To ensure that your downloaded PDFs always display correctly, regardless of what fonts a user has installed, you can configure SuperWEB2 to embed the fonts in the PDF.

  1. Open  <tomcat_home>\webapps\webapi\WEB-INF\classes\configuration.properties in a text editor.
  2. Locate the following property:

    CODE
    externalLink.pdfTemplateFonts=

    By default the properties are set to no value, which means that SuperWEB2 will not embed any fonts in the PDF.

  3. For each font you want to embed, add the full path to the font file on the machine running SuperWEB2. If you are specifying multiple fonts, separate them with commas. You must use forward slashes in the path. For example:

    CODE
    externalLink.pdfTemplateFonts=C:/Windows/Fonts/ARIALUNI.TTF,C:/Windows/Fonts/mingliu.ttc

    To obtain the full path to a font installed on your computer, go to Control Panel > Appearance and Personalisation > Fonts, then right-click the font and select Properties:

  4. Save your changes, and then restart Tomcat or the SuperWEB2 service to apply the change.

Before deciding to embed fonts in your PDFs, check the end user licence agreement of the font to confirm that it allows you to embed the font in a PDF.

Graph PDF Settings

The additional graph PDF settings are configured in <tomcat_home>\webapps\webapi\scripts\sw2-charts\sw2-chart-export-options.js.

See sw2-chart-export-options.js for full details.

Map PDF Settings

The additional map PDF settings are configured in <tomcat_home>\webapps\webapi\WEB-INF\classes\configuration.properties. You can change the following settings:

ParameterDefines
map.mapPdfDocumentPropertyAuthor
The Author Document Property in the generated PDF.
map.mapPdfDocumentPropertyKeywords
The Keywords in the Document Properties in the generated PDF.
map.mapPdfDocumentPropertyApplication
The Application Document Property in the generated PDF.
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.