Difference between revisions of "PDF Writer Custom Tags"

From SmartWiki
Jump to: navigation, search
Line 103: Line 103:
  
 
==Special Characters==
 
==Special Characters==
Most western Latin Unicode characters will be displayed normally. If your PDF will contain non-Latin characters such as Japanese then they have tell PDF writer using TTF (True Type Font) and specify the font should be used. The font must be one that can render the characters correctly.  You must also tell the PDF writer to use True Type Font by including the following anywhere with the [[Web Page View]]:
+
Most western Latin Unicode characters will be displayed normally. If your PDF will contain non-Latin characters such as Japanese then they have tell PDF writer using TTF (True Type Font) and specify the font should be used.  
* <font size="3">&lt;!--Use TTF--></font>
 
 
For example, to display Japanese characters properly do the following:
 
# Put  this '''&lt;!--Use TTF-->''' somewhere within the web page view
 
# Put this '''&lt;font face="VAL Gothic Regular">''' or '''&lt;font face="Bitstream Cyberbit">''' in front of the text that will contain the special/non-Latin characters.
 
::* Alternately you can define the font within a &lt;style> tag for each element. For example:
 
<pre>
 
<style>
 
<!--@sslogic("@me.langid@" in (7,15))-->
 
body,div,span,p,table,tr,th,td,a{
 
  font-family: "Bitstream Cyberbit",'Arial',Verdana, Arial, 'MS Sans Serif', sans-serif;
 
  font-weight:normal;
 
}
 
<!--@end-->
 
</style>
 
</pre>
 
  
'''Note:''' Many fonts such as Japanese and Korean do not fully support bold text. Accordingly using  "&lt;b>" or "&lt;strong>" tags, or style="font-weight:bold or 200 etc. (or CSS entries) may result in garbled output. Thus in the &lt;style> example above the font-weight is defined as normal. Note that any in-line styles in the Web Page View (i.e. &lt;span style="font-face:Arial">) will override the styles defined in the style tag.
+
See [[Convert Special Characters to PDF|here]] for more information
  
 
==See Also==
 
==See Also==
Line 127: Line 111:
 
* [http://pd4ml.com/taglib/pd4ml/tld-summary.html http://pd4ml.com/taglib/pd4ml/tld-summary.html] (external website)
 
* [http://pd4ml.com/taglib/pd4ml/tld-summary.html http://pd4ml.com/taglib/pd4ml/tld-summary.html] (external website)
 
* [[Web Page View]]
 
* [[Web Page View]]
 +
* [[Convert Special Characters to PDF]]
  
 
[[Category:PDF]]
 
[[Category:PDF]]

Revision as of 13:47, 7 March 2013

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. (See example below)
  • 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. (See example below)
  • <pd4ml:page.break>: inserts a page break at this location
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. (See example below). Affects all subsequent pages (unless Scope option is defined)
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]</pd4ml:page.footer>: 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.


Examples

  • The following will define HTML can be added to a Web Page View document to be used as the page header and footer. A different header is defined for the first page using the scope option.
Only the header for the first page will be displayed in the Web Page View HTML view. The header for subsequent pages and the page footer are hidden using <div style="display:none;pd4ml-display:block">
 <pd4ml:page.header scope="1">
   <div  style="margin-top: 30px;margin-left:30px;margin-right:30px;margin-bottom:30px">
    <img src="/files/12345/f51222/HeaderImage.jpg" width="250px">
   </div>
 </pd4ml:page.header>

<div style="display:none;pd4ml-display:block">
 <pd4ml:page.header scope="2+">
   <div  style="margin-top: 30px;margin-left:30px;margin-right:30px;margin-bottom:30px">
     <table width="100%">
      <tr>
       <td><img src="/files/12345/f51222/HeaderImage.jpg" width="250px"></td>
       <td style="text-align:right">page $[page] of $[total]</td>
      </tr>
     </table>
   </div>
 </pd4ml:page.header>

 <pd4ml:page.footer>
  <div  style="margin-top:30px;margin-left:30px;margin-right:30px;margin-bottom:30px">
     <table width="100%">
      <tr>
       <td><img src="/files/12345/f51221/FooterImage.jpg" width="75px"></td>
       <td style="text-align:right"><span style='font-size:9.0pt;line-height:115%;color:gray'>SmartSimple Software >></span>
         <span style='font-family:"Arial Black","sans-serif";color:#008386'> <link>www.smartsimple.com</link></span>
      </td>
      </tr>
     </table></div>
 </pd4ml:page.footer>
</div>


  • The following will show the table in the HTML view, but it will not be included in the PDF:
<table border="1" style="display:block;pd4ml-display:none">
   <tr><th>Header 1</th><th>Header 2</th></tr>
   <tr><td>row 1, cell 1</td><td>row 1, cell 2</td></tr>
   <tr><td>row 2, cell 1</td><td>row 2, cell 2</td></tr>
</table> 


  • The following will prevent a table from spanning 2 pages (unless the table is more than 1 page in length):
<table border="1" style="PAGE-BREAK-inside: avoid">
   <tr><th>Activity</th><th>Owner</th></tr>
[#(?object=activity)
   <tr><td>@subject@</td><td>@owner@</td></tr>
#]
</table> 

Page Format

To generate PDFs in Legal paper format add this tag within the body of the Web Page View:

  • <!--Use Legal-->


Special Characters

Most western Latin Unicode characters will be displayed normally. If your PDF will contain non-Latin characters such as Japanese then they have tell PDF writer using TTF (True Type Font) and specify the font should be used.

See here for more information

See Also