Difference between revisions of "PDF Writer Custom Tags"

From SmartWiki
Jump to: navigation, search
m (Changing Fonts)
m (Fonts and Special Characters)
Line 57: Line 57:
  
 
====CSS Styles====
 
====CSS Styles====
 
 
<pre>#font_times {
 
<pre>#font_times {
 
width: 700px;
 
width: 700px;
Line 103: Line 102:
  
 
====HTML Portion====
 
====HTML Portion====
 +
The above styled identifiers can now be placed within wrapped div tags for text you want to style. For example: 
  
 
==Specify PDF File Name==
 
==Specify PDF File Name==

Revision as of 13:53, 16 September 2021

The following custom tags can be included in Web Page Views to manipulate the output when converting to PDF:

List of Custom Tags (pd4ml)

style="pd4ml-display:none" or style="pd4ml-display:block": Controls whether a HTML element will be included or not included in the PDF. style="PAGE-BREAK-inside: avoid": Prevents an HTML element from being broken by a page break. Note: If the element is more than a page in length this setting cannot be applied and will be ignored.

<pd4ml:page.break>: inserts a page break at this location. We recommend using the SmartFields PDF formatting setting for inserting page breaks between custom fields.

Options:
  • ifSpaceBelowLessThan= pixels: allows to suppress the page break if the available space on the current page is more than the specified value.
  • htmlWidth=pixels: forces PD4ML to change current htmlWidth (screenWidth) value and to affect HTML-to-PDF scaling factor. “reset” returns htmlWidth to the initial state.
  • htmlWidth="reset"
  • pageFormat="rotate"
  • pageFormat="WxH"
  • pageFormat="reset"
  • next="even - odd"
  • pageCounter=pagenum


<pd4ml:page.header> </pd4ml:page.header>: Content between tags will be used as the page header.

Options:
  • scope="scope": explicitly defines pages where the header should appear. Example: scope="odd,5,15-25,45+,skiplast"
  • height="height"
  • width="width"
  • style="associated style info"
  • $[page], $[total] and $[title]: inserts current page number, total number of pages, and document title (respectively)


<pd4ml:page.footer> first page footer. page $[page] of $[total]: Content between tags will be used as the page footer (see Example below). Affects all subsequent pages (unless Scope option is defined)

Options: same as pd4ml:page.header tag.


<pd4ml:toc>: table of contents.

Options:
  • pncorr="number": a correction value to add to page numbers

<pd4ml:page.break/>: insert this for a PDF page break.

Page Format

To generate PDFs in a specific format within the body of the Web Page View, add the appropriate tag below. We recommend adding the sample template to your Web Page View custom field. This will use SmartFields and will automatically create a formatted PDF for you.

  • <!--Use Landscape--> - will set the HTML width based on the paper type.
  • <!--Use Letter--> - will set the page width to 971.
  • <!--Use Legal--> - will set the page width to 1235.

Table Size

Recommended table sizes are as follows:

  • Letter 700 pixels wide
  • Letter (landscape) 950 pixels wide

Fonts and Special Characters

The web page view sample template includes a declaration for TTF (True Type Font). This TTF declaration is required for some Unicode characters to display.


Changing Fonts

The default font for all text is Roboto. However, there are three other fonts supported for PDF creation: Arial, Verdana, and Times New Roman. If you want to change the text to one of these alternate fonts, you can create a special style for an identifier selector within the CSS portion of the HTML template. Then, when it comes time to use this style in the document, simply reference this style within the div tags. An example is displayed below:

CSS Styles

#font_times {
width: 700px;
padding-top: 15px;
text-align: left;
white-space: normal;
word-break: break-word;
float: left;
font-family: Times New Roman, Serif;
color: lightcoral;
}

#font_arial {
width: 700px;
padding-top: 15px;
text-align: left;
white-space: normal;
word-break: break-word;
float: left;
font-family: Arial, Sans-Serif;
color: goldenrod;
}

#font_verdana {
width: 700px;
padding-top: 15px;
text-align: left;
white-space: normal;
word-break: break-word;
float: left;
font-family: Verdana, Sans-Serif;
color: teal;
}

#font_default {
width: 700px;
padding-top: 15px;
text-align: left;
white-space: normal;
word-break: break-word;
float: left;
color: purple;
}

HTML Portion

The above styled identifiers can now be placed within wrapped div tags for text you want to style. For example: 

Specify PDF File Name

If the syntax <!--filename='WPF - filename'--> is included in the HTML Template, when saved as a PDF, the PDF filename will default to 'WPF - filename.pdf'.
Variables such as @name@ can be used (ex. <!--filename='WPF - @name@'-->) to dynamically set the resultant PDF filename.

See Also