Find out in this Article,
- which requirements must be met for this Fixup and
- how you can apply this Fixup.
1. Introduction
The Fixup Replace Text is available in the Workflow. This Fixup aims to replace a searched text in the file with a new text.
2. General
The Fixup Replace Text can be used to correct texts or to personalize templates. During execution, the system searches for an entered text and then replaces it with the text to be replaced.
The Fixup can be found in the Data Preparation tab of an Article, Order or Production Job :
- Entering the name of the Fixup in the Filter area,
- Activating the Text option in the Category area,
- Activating the Change option in the Action area,
- Activating the Text option in the Search area
3. Description
Use this Fixup to quickly and easily correct certain text parts within the file. To do this, enter the text part to be edited and correct it with the desired changes. Letters that are not embedded in the PDF can only be used if the corresponding font is saved in the font directory.
Use these Fixup to correct the following:
- Correct a spelling mistake
- Replace a placeholder text in a source file in order to replace the text depending on the content of a user-defined field and thus implement a mini PDF solution
3.1. Requirements and Functionality
For the Fixup to do what it promises, the following requirements must be met:
- There are text objects in the file
- The fonts do not have to be embedded. In this case, however, only those letters that are already in use in the file can be replaced.
- The font should be saved in the font directory
Figure 1: The dialog of the Fixup Replace Text
The following options can be selected to replace text:
- Templates [1] – settings selected in the dialog can be saved as a template and thus applied to other Articles/Print Items.
-
Operators [2] – use the drop-down menu to select how to search for text in the Search for (text) input field. The following options are available:
- Equal to – the text entered for the Search for (text) option corresponds exactly to the text in the file that is to be edited.
- Matches with RegEx – the entered text for the Search for (text) option corresponds to a RegEx expression.
-
Variable Content [9] – select the desired placeholder - database field or user-defined field - from which the value for the operator should be retrieved. The following values must be found in the selected field for the selection to be created:
equal_to
regex
- Search for (text) [3] – enter the text that should be edited or the RegEx expression in this field, depending on the selected operator. For the Variable Content [10] , select the desired placeholder - database field or user-defined field - from which the value for the text you are searching for should be retrieved.
- Replace with [4] – enter the new, corrected text that should be inserted here instead. For the Variable Content [11], select the desired placeholder - database field or user-defined field - from which the value for the new, corrected text should be retrieved.
-
Replace Cropped text [5] – various options are available here, allowing the corrected text to be cropped. The following options are available:
- Do not truncate – the entire corrected text is not cropped and is inserted in its full length.
- Truncate text – only a selected part of the corrected text is used from the beginning, middle or end. Enter the desired number of characters in Options [6] . The values that lead to the desired result can be read in the info box [12].
- Substring of Text – only a selected part (string) of the corrected text is used. Enter the desired number of characters in Options [6] . The values that lead to the desired target can be inspected in the info box [12].
-
Text alignment [7] – select how the corrected text should be aligned in the selection menu. The following options are available:
- Left-aligned - the corrected text is left-aligned
- Align right - the corrected text is aligned to the right
- Align centered - the corrected text is aligned in the middle (centered).
- Justified - the corrected text is inserted in justified text.
-
Variable Content [13] – select the desired placeholder - database field or user-defined field - from which the value for the text alignment should be retrieved. The following values must be found in the selected field for the selection to be created:
left_aligned
right_aligned
center_aligned
block_aligned
- Font directory [8] – enter the path that leads to the saved font directory here.
Figure 2: Left: Values in the selected field for the Operators option; Right: Values in the selected field for the Text Alignment option
3.2. Before/After
To experiment with this function, refer to the sample file "Sample_Replace Text.pdf". The file contains some text elements. The word Fixup is written at the top of the file. This text should now be corrected to Fixup Replace Text. Arial was used as the font for this line of text. The text has been embedded.
After applying the Fixup, the file "Sample_Replace Text_End.pdf" is created. Here, the text passage described was replaced by the new text. The values from Figure 1 were used for this.
Figure 3: Left: initial file; Right: revised file in which the text line has been corrected
Article update: Workflow 1.18.0 – 08/2024