Insert Page Break or Page Split for Save as PDF

  • 15 February 2022
  • 0 replies
  • 326 views

Userlevel 5
Badge +20
 

Insert Page Break or Page Split for Save as PDF

KBS100270

PRODUCT
K2 Cloud
K2 Five
K2 blackpearl 4.7
BASED ON
K2 Cloud (all)
This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.

Objective

The goal of this KB is to provide a technique to add a Page Split or Page Break via CSS code to a SmartForm. This is used with the Save as PDF control to print SmartForms as PDFs with custom Page Breaks.

Please note that K2 automatically inserts page breaks when needed, paying attention not to break lines of text or images. When custom page breaks are required, they can be added using simple page-break-before and page-break-after CSS styles. 

Before You Begin

Confirm that the SmartForm utilizes the Save as PDF control correctly.

Please CLICK HERE for more information on the 'Save as PDF' Control and instructions for configuring the control.

 

 

How-to Steps

1. Open the SmartForm and click the Expressions button.

2. In Expressions,  click 'Add' and give the Expression a name. (Example: PDF_Page_Break)

3. Add the following code to the Expression Details.

<table> <tr style="page-break-after:always"> </tr></table

The Expression wizard should look like this when complete:

4. Drag a [Data Label] from the Toolbox and drop it on the SmartForm where a Page Break is needed. The [Data Label] can be renamed.

5. The [Data Label] needs to be set to Literal by enabling the checkbox in properties.

6. Click on the SmartForm's Rules tab and add a 'When the Form raises an event' rule to the form. Click 'select event' and choose Initialized

The SmartForm may already have a rule titled, "When the Form is Initialized". If so, there will be a pop-up that says:

"You are trying to configure an existing rule. To load the existing rule click Yes, otherwise click No to configure a new Rule"

Click Yes and the following steps should be added to the existing rule.

7. Add a "Transfer Data" Action to the rule and drag the 'PDF_Page_Break' Expression to the Data Label.

8. Click 'OK' to save the rules and 'Finish' the SmartForm. The Page Break setup is complete and can be tested. 

For additional information related to the HTML to PDF converter and the CSS styles that control page breaks please see these links from outside K2: 
http://www.expertpdf.net/expertpdf-html-to-pdf-converter-page-breaks/
https://www.html-to-pdf.net/html-to-pdf-converter.aspx

 

 

 

 


0 replies

Be the first to reply!

Reply