Web Page View custom fields use custom pd4ml tags, table size values, and font classes to control how HTML output converts to a formatted PDF in SmartSimple.
Custom Tags for Web Page View Custom Field PDF Output
Include the following custom pd4ml tags in a Web Page View custom field to change the output when SmartSimple converts it to PDF. Wrap each tag in angle brackets.
Element Display, Page Break Avoidance, and Table of Contents Tags
The following tags control element display, page break avoidance, and table of contents output in a Web Page View custom field PDF:
| Tag | Description |
|---|---|
| <style="pd4ml-display:none"> | Excludes an HTML element from the PDF. |
| <style="pd4ml-display:block"> | Includes an HTML element in the PDF. |
| <style="PAGE-BREAK-inside: avoid"> | Prevents a page break from splitting an HTML element in the PDF. If the element is longer than one page, the setting cannot be applied and is ignored. |
| <pd4ml:toc> | Inserts a table of contents into the PDF. |
| pncorr="number" | Option for the pd4ml:toc tag. Adds a correction value to the page numbers. |
Page Break
The <pd4ml:page.break> tag inserts a page break at its location in the PDF output of a Web Page View custom field. It is recommended to use the SmartFields PDF formatting setting to insert page breaks between custom fields.
The <pd4ml:page.break> tag can also be written as a self-closing tag, <pd4ml:page.break/>. Both forms insert a page break at the location of the tag.
The <pd4ml:page.break> tag supports the following options:
| Option | Description | Example |
|---|---|---|
| ifSpaceBelowLessThan=pixels | Breaks the page only if less than the specified space, in pixels, remains on the page. | <pd4ml:page.break ifSpaceBelowLessThan="200"/> |
| htmlWidth=pixels | Changes the HTML width used for scaling, starting at this page break. | <pd4ml:page.break htmlWidth="1200"/> |
| htmlWidth="reset" | Returns to the original HTML width. | <pd4ml:page.break htmlWidth="reset"/> |
| pageFormat="rotate" | Rotates the page orientation, for example, from portrait to landscape. | <pd4ml:page.break pageFormat="rotate"/> |
| pageFormat="WxH" | Sets a custom page size. | <pd4ml:page.break pageFormat="800x600"/> |
| pageFormat="reset" | Returns to the original page format. | <pd4ml:page.break pageFormat="reset"/> |
| next="even - odd" | Makes the next page start on an odd or even page number. | <pd4ml:page.break next="odd"/> <pd4ml:page.break next="even"/> |
| pageCounter=pagenum | Sets the page counter to a specific number. | <pd4ml:page.break pageCounter="5"/> |
Page Header
The <pd4ml:page.header> tag and the closing </pd4ml:page.header> tag define the page header of the PDF. The content between the tags is used as the page header.
The page header supports the following options:
| Option | Description |
|---|---|
| scope="scope" | Defines the pages where the header appears. For example, scope="odd,5,15-25,45+,skiplast". |
| height="height" | Sets the height of the header. |
| width="width" | Sets the width of the header. |
| style="associated style info" | Applies the associated style information to the header. |
The following values insert document details into a page header or footer:
| Value | Description |
|---|---|
| $[page] | Inserts the current page number. |
| $[total] | Inserts the total number of pages. |
| $[title] | Inserts the document title. |
Page Footer
The <pd4ml:page.footer> tag and the closing </pd4ml:page.footer> tag define the page footer of the PDF. A typical footer entry is page $[page] of $[total]. The page footer supports the same options as the page header.
Table Size for PDF Output
The recommended table width for a Web Page View custom field converted to PDF depends on the paper format and orientation:
| Paper Format | Recommended Table Width |
|---|---|
| Letter | 700 pixels wide |
| Letter (landscape) | 950 pixels wide |
Fonts and Special Characters
A Web Page View custom field PDF uses a default font and supports three alternate fonts. The following sections describe the default font, the alternate fonts, and the CSS classes that apply them.
Default Font and TTF Declaration
The default font for all text in a Web Page View custom field PDF is Roboto, and Roboto is the recommended font. The Web Page View custom field sample template includes a declaration for True Type Font (TTF). The TTF declaration is required for some Unicode characters to display.
Alternate Fonts
A Web Page View custom field PDF can use Times New Roman, Arial, or Verdana instead of the default font.
Font CSS Classes
To use an alternate font in a Web Page View custom field PDF, add a CSS class within the head of the Web Page View custom field template. Then reference the CSS class in the custom content wherever the system font should be overridden.
Example
The following CSS classes set a font and a color for each supported alternate font, and a color for the default font:
.font_times {
font-family: Times New Roman, Serif;
color: lightcoral;
}
.font_arial {
font-family: Arial, Sans-Serif;
color: goldenrod;
}
.font_verdana {
font-family: Verdana, Sans-Serif;
color: teal;
}
.font_default {
color: purple;
}Font Class HTML
Place the CSS classes within div tags that wrap the text to style in the Web Page View custom field template.