PDF Output Business Object

The PDF Output Business Object serves as the blueprint for static or data-driven document templates. It enables the creation of structured PDF documents that can include:

  • Text blocks

  • Images and vector graphics

  • Static and dynamic tables

  • Conditional components based on business logic

Properties and Editor

In the PDF Output Business Object library, the Properties tab on the right-hand side allows performing four actions:

PDFOutputProperties.png

  1. Language defines the selection criteria when the PDF Output is used in a Document (see Document and Document Set Business Objects).

  2. Copy Fields and Variables allows copying fields and Variable definitions from a different PDF Output Business Object. Consider that, if the target PDF Output contains variable definitions with the same name, these are overwritten.
  3. Replace PDF allows replacing the default PDF with a different one. Default PDF is a blank A4 page (by replacing the default PDF, you can also change its size). Note that, if the new PDF has less pages than the replaced file, all the fields existing on the "lost" pages are also removed.
  4. Open PDF opens the plain PDF in a separate tab.
  5. PDF Info provides information on PDF version, size, and so on.

Once you open your PDF Output Business Object, the editor is divided into four parts:

PDFOutputOverview.png

  1. Dependencies
  2. The actual editor, where you can edit your PDF Output
  3. The Components library, which shows a list of all Field types you can use to assemble your PDF Output, as well as a list of assigned variables.
  4. The available Properties for the currently selected Component/s. If no Component is selected, the PDF Output properties are shown.

Resizing Editor Areas

All four Areas of the Editor can be resized. Depending on what you're doing, different functions of the editor may be more important to you. Resize areas to suit your current task. Here's how you do it:

  • Move your mouse near the border between different areas
  • As soon as your mouse icon turns to the "resizer" icon, click and drag

Working with Fields

Adding Fields

You can either add Fields of a specific type with an empty binding, or Text fields with a specific binding.

  • To add a Field of a specific type, drag from the Fields list.
  • To add a Text Field with a functional binding, drag it from the "Variables" tree.

Selecting Multiple Fields

You can select multiple Fields. To add or remove a Field from the list of selected Fields, do the following:

  1. Hold down the Ctrl key
  2. While keeping the Ctrl key pressed, left-click on the Field

Another way to select a large number of fields is using the drag selector:

  1. Click outside of any field
  2. Start dragging. A square appears.
  3. Keep dragging until all fields you want to select are within the square
  4. Release the mouse button

You can discern between selected and unselected Fields by the color of their border:

  • Unselected Fields have a black border
  • Selected Fields have a blue border

Selecting "Hidden" Fields

Sometimes, a Field can be hidden behind another Field. If that occurs, it can be impossible to select this hidden field by simply clicking on it. If this happens, hold down the Alt key while clicking. This will cycle the selection through all fields overlapping the point you are clicking.

Removing Fields

In order to remove one or several Fields, do the following:

  1. Select the Field or Fields you wish to delete
  2. Either right-click on a Field and select Delete or
  3. Simply hit the backspace or delete key

Copying Fields

To create copies of any fields, do the following:

  1. Select the field/s you wish to copy, press the Alt key and start dragging while keeping it pressed.
  2. Drop the fields to the target location and release the Alt key.

You can also copy fields using the Copy/Paste function:

  1. Select the field/s you wish to copy.
  2. Press the Ctrl-C or select Copy from the context menu.
  3. Go to the page where you want to paste the fields.
  4. Hit Ctrl-V or select Paste Field(s) from the context menu.

Arranging Fields

When editing a PDF Output, one of the most important tasks is getting the Fields to look correct in the resulting PDF file. In order to help you achieve this, the editor provides several features.

Help Lines

Help lines are temporary and are removed if you close the PDF Output. When dragging Fields, they attach to help lines. Hold down Ctrl to disable this temporarily.

  • To add help lines, click into the ruler.
  • To move help lines, drag the help lines.
  • To delete a help line, drag it to the ruler.
  • To delete all help lines, use the context menu.

Automatically Aligning, Distributing and Resizing Fields

To automatically resize selected Fields to match the height of the Text Style they contain, use the Context Menu. Select Resize Field to Text Height.

If several Fields are selected, you can align and distribute these Fields using the buttons in the button bar:

1.bmp

Figure 1 : The buttons used to automatically align Fields

From left to right, the buttons in the button bar do the following:

  • Align all selected Fields to their leftmost border
  • Align all selected Fields to their rightmost border
  • Align all selected Fields to their topmost border
  • Align all selected Fields to their bottommost border
  • Evenly distribute all selected Fields vertically
  • Evenly distribute all selected Fields horizontally
  • Resize all selected Fields to the first selected Field width
  • Resize all selected Fields to the first selected Field height

Roll your mouse over a button to show a tool tip indicating the button action.

Smart Align

Smart Align automatically aligns a Field to other Fields whilst the Field is being dragged. Check or uncheck the Smart Align check box to activate or deactivate this feature. To turn this feature off temporarily, simply hold down Ctrl while dragging fields.

Cross-Hair

To show a Cross-Hair to help you align Fields, hold down Ctrl+Shift while moving the mouse.

Properties

All Fields, as well as each page, have a set of Properties which change how they look and behave. These Properties are listed in the bottom center part of the editor. If one or several Fields are selected, these Fields' Properties are shown. If no Field is selected, the currently opened page properties are shown.

All fields have a generic set of Properties, as well as a set of Value Field Parameters specific to the field type.

Page Properties

Page Properties control the visibility and replication of the current page. Replication of any page is used when content with unknown size is expected.

  • Replication Strategy — Determines the strategy of replication. This property is only used in conjunction with Output Fields containing dynamic tables.
    • Not Replicated
    • Replicated if visible (depending on the Visibility property below)
    • Always Replicated
  • Visibility — An Expression evaluation to true or false which determines if the page is visible

Generic Field Properties

Properties common to all fields are called Generic Properties and they are found in the Properties tab. They are:

  • Name — A human-readable name. This is important if another Field references the current Field. If such references are needed, Fields' names are used.
  • Description — A short, human-readable description used for documentation purposes
  • Next Field ID — Fields containing dynamic content can be interconnected to control the flow of propagation of the dynamic content.
  • x — Horizontal position on the page, measured from the top left corner, in millimeters
  • y — Vertical position on the page, measured from the top left corner, in millimeters
  • width — Width in millimeters
  • height — Height in millimeters
  • Background Color — A color used to fill the field background. If no color is set, the field is transparent. To set a color, use RGB values from 0-255, e.g. "100,100,100" for a medium grey.
  • Background Transparency — The Field background color transparency. It is a floating point value between 0.0 and 1.0

  • Marker Expression — Table of Content marker expression which will evaluate to a String. See PDF Table of Contents.

  • Copy — Copy Strategy of Fields: 
    • Only on This Page (default)
    • On This Page and Copies of This Page
    • On All Pages
  • Z-Index — Specifies the order in which Fields are "stacked" or "drawn." Fields with larger Z-Indices are drawn over other Fields and appear "above" them.
  • Expression — The Field binding, i.e. the variable it takes its display value from or any expression which will evaluate to a String.
  • Visibility — An Expression indicating whether a field is visible
  • Replication Strategy — Select Replicated if more space is needed to display its content. This attribute is used in conjunction with dynamic content.
  • Skip Page if empty — If all Fields are empty, the whole page is skipped.

  • Blank — If this property is set to false, and the Rule Document evaluates to true, it will not be rendered.

Value Field Parameters

Each field type has a number of additional Properties. The first Value Field Parameter is the Field type itself, which can be changed even after placing a Field of a given type. The other Parameters are described below. All the Parameter input fields define expressions that must return a (floating point) number or String. Example: The Image URL must be a String expression such as http://....jpg, while the Image Rotation can be a plain number or numeric expression such as 1.0+2.5.

Note on Color fields (font color, background color, and so on). Color fields must mmet the following requirements:

  • The value in the field must always be a String or an expression that evaluates to a String

  • Accepted formats of such String are:

    • Color BO ID in format <Color BO ID> or {#<Color BO ID>}

    • HTML color names e.g., red, blue

    • Hex color codes in format #fe1012, fe1012or #f11

    • RGB color codes in format 110,200,180, 110,200,180,100 (with alpha channel, int), rgb(110,200,180), or rgba(110,200,180,0.5) (with alpha channel, float)

Barcode 128

Standard barcode type

  • Align — Field content horizontal alignment.
  • VAlign — Field content vertical alignment.
  • Minimum Bar Width — Minimum width of the thin bars of the barcode (this must be tested with the barcode scanner in use)
  • Height — Height of the barcode image
  • Rotation — Rotation of the barcode in Degrees (0 or 90 Degrees)
  • Scale — Sets the image size multiplier relative to its original dimensions.

Barcode Datamatrix

Standard 2D bar code type

  • Rotation — Rotation of the bar code in Degrees (0 or 90 Degrees)
  • Scale — Sets the image size multiplier relative to its original dimensions.
  • Align — Field content horizontal alignment.
  • VAlign — Field content vertical alignment.

Barcode PDF 417

Standard 2D barcode type

  • Rotation — Rotation of the bar code in Degrees (0 or 90 Degrees).
  • Scale — Sets the image size multiplier relative to its original dimensions.
  • Align — Field content horizontal alignment.
  • VAlign — Field content vertical alignment.

Barcode Planet

Standard barcode type

  • Rotation — Rotation of the bar code in Degrees (0 or 90 Degrees).
  • Scale — Sets the image size multiplier relative to its original dimensions.
  • Align — Field content horizontal alignment.
  • VAlign — Field content vertical alignment.
  • Foreground Color — The color used to draw the barcode itself.
  • Background Color — The color used to draw the barcode background, given in single-quoted RGB-values (e.g. '200,200,200')

Barcode PostNet

Standard barcode type

  • Rotation — Rotation of the bar code in Degrees (0 or 90 Degrees).
  • Scale — Sets the image size multiplier relative to its original dimensions.
  • Align — Field content horizontal alignment.
  • VAlign — Field content vertical alignment.
  • Foreground Color — The color used to draw the barcode itself.
  • Background Color — The color used to draw the barcode background.

Graphic

Plug-in custom graphics via the FNZ Studio Graphics Listener interface.

Install the WorkflowImage Extension. In the Value Field Parameters, set Listener to flowimage and Expression to a String expression returning an existing Process ID. This will render a vector image of the Process into the PDF.

  • Listener Name — An expression evaluating to a String representing the name of the listener defined in the extensions implementing the graphic interface.

  • Version Filter — An expression evaluating to a String. The String produced must be the same as used for the VersionFilter(String) Script Function. The Version Filter will then be applied for the evaluation of this graphic.

  • Expression — Data binding expression to pass data to the extensions for evaluation and graphical display.

  • Resolution — By default, the internal rendering will take place with an in-memory image with the image resource’s width and length. These internal dimensions will be multiplied by the factor defined with this parameter.

Image

Any Image from a Resource Business Object, URL or file path.

  • Align — Field content horizontal alignment.
  • VAlign — Field content vertical alignment
  • Resource — A Resource (image etc.) type to be rendered into the Field.
  • URL — A web resource.
  • File Path — A local file path resource.
  • Scale — Sets the image size inside the filed rectangle area.
  • DPI — Image resolution inside the PDF.

Stroke

Square Overlay to strikeout parts of the underlying Document.

  • Stroke — Type of stroke.
  • Color — Color of the stroke.
  • Line Width — Width of a stroke(in pt).

Table

Table is used to display more complex content. Its Expression is always bound to a PDF Output Table defining the visual structure of the dynamic content (see PDF Output Table Business Object). An example of this Expression is PdfOutputTable('id') (the ID is found in the BO Library > PDF Output Table BOs).

  • Font Style — The Font Style to be used to print the Table
  • Font Color — The Font color.
  • Lead — Lead of the Font (line spaces)

Text

Multi-line Field containing a text string defined via an Expression.

  • Indent — Start position of the first line
  • Font Style — A Style from a list of pre-defined Font Styles
  • Font Color — The Font color.
  • Lead — Lead of the Font (line spaces).
  • Align — Text horizontal alignment; "justified" tries to fill the full width of all but the last line
  • VAlign — Text vertical alignment
  • Hyphenation — Whether to use hyphenation when rendering the text
  • Run direction — Determines the direction in which the text is rendered. Set right-to-left for languages such as Arabic or Hebrew.
Tip: Ensure that the 'Align' parameter, which defines the horizontal alignment, is set accordingly.

Table of Contents

The Table of Content is described with a PDF Output Table and bound with the following Expression: PdfOutputTable('id') (the ID is found in the BO Library > PDF Output Table BOs).

  • Font Style — The Font Style to be used to print the table.
  • Font Color — Font color.
  • Lead — Lead of the Font (line spaces).

Keyboard Shortcuts

The PDF Output Editor provides a number of keyboard shortcuts. Note that most shortcut keys are common to all editors (see ). The following table summarizes how these shortcuts behave in the specific case of the PDF Output Business Object.

Shortcut Description
Ctrl-S Save the PDF Output
Ctrl-A Select all Fields
Ctrl-W Close the PDF Output Editor
Ctrl-D Duplicate all active fields
Ctrl-C Copy all active Fields
Ctrl-X Cut all active Fields
Ctrl-V Paste copied fields
Delete or Backspace Delete the selected Fields
Holding down Ctrl key while clicking on a Field Toggle the Field selection (i.e. add it to the selection if it was unselected, or remove it from the selection if it was selected)
Holding down Ctrl key while dragging open a selector square Add the fields inside the selector square to the selection
Holding down Alt key while clicking several overlapping Fields Switch which of the fields is selected
Holding down Alt key while starting to drag a Field Copy the Field instead of moving it
Hold Shift and Ctrl while moving mouse Display Cross Hair
Arrow Keys Move Selected Fields (also hold down Alt to move 10 Pixels at a time)
Hold down Shift and press Arrow Keys Resize (also hold down Alt to resize 10 Pixels at a time)
Hold down Shift while moving Fields Only move horizontally or vertically
Hold down Shift while resizing Fields Only resize horizontally or vertically
Hold down Ctrl while moving Fields Ignore help lines and smart align if it is activated
Tab Deactivate the currently active Field and activate the next Field
Shift-Tab Deactivate the currently active Field and activate the previous Field
Ctrl Temporarily disable "snap-to" for Guidelines and Smart Align

Use Cases

This section illustrates some uses cases you may encounter while working with PDF Output Business Objects.

Changing/ Updating Fields in Multiple PDFs

In some cases, you may need to change a PDF Output field in multiple PDFs. Let's assume, for example, you originally set up a field to be the client's first name followed by their last name. Now you need to change it into last name - first name.

To avoid having to manually change each PDF Output field, we recommend using Data Class functions instead.

Follow these steps:

1. First, create a function in the Data Class corresponding to the value needed for the field in the PDF Output. For example, go to the Data Class Person and add a function such as:

Copy
Function getFullName() : String Begin
Return JOIN($this.firstName, ' ', $this.lastName);
End

2. Add an expression in the PDF Output field: $person.getName(). This way, only the function needs to be changed when you wish to adapt the PDF Output field, instead of you having to adapt the expression in each PDF Output field displaying the name of a client.

Estimating Barcode Sizes

Let's suppose you want to create or adapt a barcode in a PDF Output document. Since the data contained in the barcode is usually filled through a function, the preview tab cannot show you how large the barcode field will be. However, this is important information to style PDF documents.

There is actually a way to test the size of any barcode according to the number of characters it will likely contain. Let's take the example of a datamatrix barcode.

  1. Choose an existing PDF Output object and add a mock barcode (e.g. Barcode Datamatrix).

  2. Estimate the number of characters which the data in the barcode will include. For example: 100.

  3. In the Expression field of the Barcode component, enter a string expression with the estimated number of characters or use the function RandomText(n) to add n characters. For example 100 characters: '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'

    OR

    RandomText(100)

  4. Validate, save and click on the Preview tab.

    This is how a Datamatrix Barcode with 100/150/200/250 characters would look like:

Numbering Pages

To add page numbering when rendering PDF documents, you can , add a Text component in your PDF document. Within this Text component, there are multiple placeholders you can use, as illustrated below.

Placeholders that do not consider injected duplex pages

  • $$KD

    Current overall page number

  • $OD[0-9]

    Current overall page number plus an additional offset, e.g. '$$OD3'

  • $$P[0-9]

    Current page number in current form plus an additional offset, e.g. '$$P3'

  • $$M

    Maximum page number in current form.

  • $$MP

    Maximum page number in current form plus an additional offset defined by '$$P[0-9]'. To make this option work it must appear in the same string as the '$$P[0-9]' expression.

  • $$XD

    Maximum overall page number.

  • $$XDO

    Maximum overall page number plus an additional offset defined by $$OD[0-9]. To make this option work it must appear in the same string as the $$OD[0-9] expression

Placeholders that consider injected duplex pages

  • $$K

    Current overall page number.

  • $$O[0-9]

    Current overall page number plus an additional offset, e.g. '$$O3'.

  • $$P[0-9]

    Current page number in current form plus an additional offset, e.g. '$$P3'.

  • $$N

  • Maximum page number in current form.

  • $$NP

    Maximum page number in current form plus an additional offset defined by '$$P[0-9]'. To make this option work it must appear in the same string as the '$$P[0-9]' expression.

  • $$X

    Maximum overall page number.

  • $$XO

    Maximum overall page number plus an additional offset defined by $$O[0-9]. To make this option work it must appear in the same string as the $$O[0-9] expression.