Step by step - Learn how to use callas productscallas pdfToolboxPlace contentPlace any content: Basics (“Place Content” via HTML templates

Place any content: Basics (“Place Content” via HTML templates

The Place Content Fixup (Fixup type: “Place content on page”) allows you to place PDF content. It can make use of standard or user-defined HTML templates. To achieve this, the pdfToolbox uses callas pdfChip technology. This latter software is designed to convert HTML files into high-quality PDF documents. In short, the following formula applies: HTML + CSS + JavaScript = PDF.

An overview of the release versions of pdfChip in pdfToolbox can be found here.

Settings options for Fixups of type “Place content on page”

Korrekturen der Kategorie „Inhalte auf Seite platzieren“

The Fixups supplied with the pdfToolbox based on the “Place content on page” template can be found in the “Shapes, Variables, JavaScript, Place content” library. To see and/or edit settings options for this function, select one of the highlighted “Place” fixups (you can restrict the number displayed using a search term), then click the Edit... button.

In the “Edit Fixup” window, you can see the following options.

  1. The Fixup type in this case is “Place content on page”
  2. Under Folders, you can select the folder containing all HTML files, styles and scripts required to use HTML templates. The folders shown in the image below are supplied as standard. Click on Open folder with configuration files to view the corresponding location within the file system. The orange triangle allows you to use variables here and for all other relevant settings.
  3. In this field you can specify a horizontal offset (relative to the point specified under 6.) Negative values move the element to be placed downward.
  4. This field is used to specify a vertical offset (relative to the point specified under 6.) Negative values move the element to be placed to the left.
  5. Under Unit, you can choose between pt, mm and inches.
  6. The Relative to option lets you set the reference point or reference area: Bottom left corner, left side of page, upper left corner, top of page, right side of page, bottom right corner, bottom of page and center of page.
  7. Of relates to page geometry spaces to be used as the starting point (CropBox, TrimBox, BleedBox, MediaBox, ArtBox.)
  8. If you want to rotate the placed content, you can enter a figure under Rotation (degrees).
  9. Activate the “Create on layer” checkbox to place the content on a new, separate layer.
  10. You can also enter the layer name here.
  11. The Place option lets you specify whether the content should be placed in the foreground or the background.
  12. In this field, you can set the Opacity in percentage so that the content is placed transparent on the page.
  13. You can select a Blend mode for the transparency.
  14. If the content to be placed should be transparent on the PDF page, an isolated or non-isolated Transparency group must be defined. Read more about this in the article: Place content transparently or opaquely.
  15. Apply to relates to page areas such as “All”, “Page is an even page,” “Page is an odd page,” and many others.
  16. You can specify scripts and variables under Variables.
  17. The List view provides an overview, even when the available settings are very extensive.
  18. Apply this fixup to: This can be limited to “Current file” and/or “Embedded files”.
  19. This setting lets you lock the Fixup to protect it against changes.
  20. The Name of the fixup should reflect its intended purpose.
  21. The Comment field allows you to describe the Fixup in greater detail.

Folder and file structure for HTML, styles and scripts

Ordner- und Dateistruktur

For the use of HTML templates to place content, in this example we see folders and files for the fonts, scripts and styles used (each of which is optional), as well as the obligatory index.html. The content in the Temp files folder is updated every run:

  1. The HTMLTemplates folder will be created by the pdfToolbox in the folder for the callas pdfToolbox version currently in use, under Repositories/Custom/Folder with a time stamp.
  2. This will include - depending on the library - a number of predefined examples such as “Add colorbar - cmyk”. It will include the following folders and files:
  3. The fonts folder, containing all fonts required for the HTML template,
  4. The index.html file which is required in all cases,
  5. The scripts folder containing JavaScript files,
  6. The styles folder for CSS files.

Naturally, the folder names for “fonts”, “scripts” and “styles” can be changed depending on the template.

After the first run using a given HTML template, pdfToolbox will create the callas_temp folder.

This folder contains temporary files and will be recreated each time the Fixup is run.

The following files will be included here: “calsDocInfo.js” (contains information regarding the running of the “Place content” Fixup; see Use information about the PDF document); the index.pdf file (the PDF content generated using the HTML template); and pdfChip.log (a log file).

Important: The user can create folders for their own Place Content Fixups using any name, such as an “images” folder for images. These folders must be referenced within index.html to allow pdfToolbox to access them.

Supplied examples for “Place content on page” using HTML templates

callas software supplies a number of “Place content on page”-type Fixups with the standard version of pdfToolbox which use HTML templates.

This includes three Fixups for adding color bars in CMYK, grayscale and spot colors, as well as Fixups for dimension arrows (GitHub link), document names, fold marks (letter) (GitHub link), job ID (GitHub link) and registration marks (GitHub link).

Important: As you by now know that the "Place Content" fixup in callas pdfToolbox uses an HTML file and converts it to PDF. This gives you a lot of liberty in how to structure your HTML, in how you link to other files such as scripts, CSS and fonts and in how to structure the folder you use to hold that template. We have a template folder on GitHub where you find one possible way to do this. You'll find a liberal use of sub folders and CSS and Javascripts that are referred to, rather than included in the HTML file. You're free to follow this standard or implement your own. 

Add additional content: PDFs or Images on PDF

The "Place content on page" Fixup also gives you the possibility to place an image or a PDF file on the page - all without a full HTML template.

  1. Under Folders, you can select the folder containing all HTML files, styles and scripts required to use HTML templates. The folders shown in the image below are supplied as standard. Click on Open folder with configuration files to view the corresponding location within the file system.

2.  Add a new folder, for example "Add PDF". Then you can copy any PDF or image file to this folder.

3.  After the Fixup is closed and reopened, the new "Add PDF" folder appears in the dropdown menu. Now the PDF or image can be placed on the page.