Place individual text per page

If you want to place individual text on the pages in a PDF file, you may build your solution based on an adjustable Process Plan "Place individual text per page" that is introduced with pdfToolbox 13. You will find it in the Library "Shapes, Variables, JavaScript, Place content".


The Process Plan uses in the second step the Fixup "Arbitrary JavaScript controlled Fixups". This Fixup is configured based on JavaScript structures representing any other ("real") Fixup. The structure that is used here is the one of "Place text".

You may adjust the structure in the first step so that e.g. the text strings, their position and their color meet your expectations.

Step 1: createTextConfigs

There are two adjustable sections: The textArray with the text strings and the layout parameters for the texts.



The first element in this array will be placed on the first page and so on. With a 4 element textArray the fifth page will again use the same text that was used on the first page. It should be easy to adjust the textArray according to your requirements.

Layout parameters


Right below the textArray there is the function "buildConfigs" which specifies configuration sets for each page of the PDF file. In the core of this function is the object params. For each page one instance of this object is put onto the list of configurations for Place text so that there will be as many such configurations as there are pages in the PDF file.

You may edit all values in params except:

  • "apply_to" which specifies the page for the current configuration
  • "text" which takes one element out of the textArray

All other parameters should be self explanatory, you will find additional information in the comments of the step.

Step 2: JavaScript based Fixup using createTextConfigs

This step only applies what has been set up before.