4.3.4.8. PDF Out
PDF Wizard screen allows you to define your PDF message format based on your XHTML template file.
To define a message in PDF format, select an existing template or make a copy of the generic PDF template in the catalog and the following screen will be displayed.
Wizard screen
When you create a new message format, you must first configure it using the following wizard.
A PDF message can only be set up using a template file in XHTML format. Select your template file using the Choose File button next to the XHTML file, then click on the Confirm command.
File sample
Below is a sample PDF file.
<?xml version="1.0" encoding="UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>PDF output</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <style> @page { size: A4; margin: 3cm 1.5cm 2cm 1.5cm; border: none; padding: 1em; } @page { @top-left{content: ""; }} @page { @top-right{content: "Page " counter(page) " on " counter(pages);}} @page { @bottom-left{content: element(footer);border-top: solid 0.01mm #000; }} #footer{display: block; position: running(footer); } </style> </head> <body style="font-size: 12pt; font-family: 'Nobile'"> <center> <h1 >PDF output example</h1> </center> <br/> <div style="font-size: small"> <span>Date :</span> <span id="invoiceDate">25-08-2009</span> </div> <br/> <center style="font-size: large">Example</center> <br/> <table style="width: 100%" > <tr> <td rowspan="1" style="width: 200px; height: 20px;"> <span>Invoice number :</span> <span id="invoiceNumber">field1</span> </td> <td style="width: 300px; height: 20px;"> <span>Contact Name :</span> <span id="firstName">field2</span> <span id="lastName">field3</span> </td> </tr> </table> <br/> <center> <span>Some static info</span> </center> <table style="width: 100%" dir="ltr" frame="box"> <tbody> <tr> <td bgcolor="#cdd5cb" rowspan="1" style="width: 120px; height: 30px;">Description</td> <td bgcolor="#cdd5cb" style="width: 80px; height: 30px;">Unit price</td> <td bgcolor="#cdd5cb" style="width: 40px; height: 30px;">Qty</td> <td bgcolor="#cdd5cb" style="width: 80px; height: 30px;">Vat rate</td> <td bgcolor="#cdd5cb" style="width: 100px; height: 30px;">Tax free price</td> <td bgcolor="#cdd5cb" style="width: 80px; height: 30px;">Tax</td> <td bgcolor="#cdd5cb" style="width: 80px; height: 30px;">Total price</td> </tr> <tr id="product-loop"> <td style="width: 120px; height: 20px;" rowspan="0"><span id="itemDescription">Support pack 5h</span> </td> <td style="width: 80px; height: 20px" align="right"><span id="itemUnitPrice">425.00</span> </td> <td style="width: 40px; height: 20px" align="right"><span id="itemQuantity">1</span> </td> <td style="width: 80px; height: 20px" align="right"><span id="itemVatRate">21.00</span> </td> <td style="width: 100px; height: 20px" align="right"><span id="itemTaxFreePrice">425.00</span> </td> <td style="width: 80px; height: 20px" align="right"><span id="itemTax">89.25</span> </td> <td style="width: 80px; height: 20px" align="right"><span id="itemTotalPrice">514.25</span> </td> </tr> </tbody> </table> <br /> <center style="page-break-before:always"> <span>second page</span> </center> <br/> You can upload images or css sheets as file properties and use a simple relative url in your xhtml. <br/> <br/> For specific print css options, see http://www.w3schools.com/css/css_reference.asp for all css options <br/> <br/> <h2>Barcode Integration</h2> <br/> <barcode style="display: inline-block; width: 300px; height: 200px;" type="EAN13">123456789012345675</barcode> <br/> <barcode style="display: inline-block; width: 300px; height: 200px;" type="EAN8">123456789012345675</barcode> <br/> <barcode style="display: inline-block; width: 300px; height: 200px;" type="UPCA">123456789012345675</barcode> <br/> <barcode style="display: inline-block; width: 300px; height: 200px;" type="UPCE">01234133</barcode> <br/> <barcode style="display: inline-block; width: 300px; height: 200px;" type="CODABAR">A123456789A</barcode> <br/> <barcode style="display: inline-block; width: 300px; height: 200px;" type="CODE39">123456789012345675</barcode> <br/> <barcode style="display: inline-block; width: 300px; height: 200px;" type="CODE39_EXTENDED">123456789012345675</barcode> <br/> <barcode style="display: inline-block; width: 300px; height: 200px;" type="CODE128">123456789012345675</barcode> <br/> <barcode style="display: inline-block; width: 300px; height: 200px;" type="CODE128_UCC">123456789012345675</barcode> <br/> <barcode style="display: inline-block; width: 300px; height: 200px;" type="CODE128_RAW">123456789012345675</barcode> <br/> <barcode style="display: inline-block; width: 300px; height: 200px;" type="EAN8">123456789012345675</barcode> <br/> <barcode style="display: inline-block; width: 300px; height: 200px;" type="POSTNET">123456789012345675</barcode> <br/> <div id="footer"> Footer line#1<br/>Footer line#2 </div> </body> </html>
Edit screen
Once the message format template has been uploaded, or when it is used or copied from a saved format, you have the possibility to go on the created element. If you want to edit the properties of that message definition, switch to "Properties".
The following properties are available:
The Xhtml template which defines structure of the requested PDF. |
|
Resources used inside the Xhtml template such as images, css files,... |
|
If you check this, whenever some extracted fields will cause validation errors, you'll be notified by e-mail and able to fix the message. |
|
List of emails where the error notification is sent. |
In order to ease the navigation, the xhtml attribute id is used as the name in the resulting message definition. These elements are visible by default. Mapping to these elements will be preserved if you upload another template containing the element with the same id. The attribute id needs to be using valid xml syntax (e.g.: spaces are not allowed).
If you need to add a loop to your xhtml, you can simply name the element with a suffix -loop like in the example above. The system will create a loop and a corresponding element. Mapping to these elements will also be preserved if you upload another template.
All elements without id in the xhtml will be hidden by default. If you cannot add an id to your element, you have to manually show any element you need in the transformation step. Additionally, you should edit and rename the element label for easier management during transformation step.
To ease the search of the fields you need, the values uploaded from your example file are displayed in the field tooltip descriptions.
For Message Definition OUT of type PDF, we can generate bar code from a value. To do this, we have to add a <object type=”image/barcode” field in the xhtml representation. The attribute “value” must be filled by the transformation. value can use only characters from “0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%
"
Here is a sample xhtml code with a barcode
<body>
<table id="Facure" class="MyTable" style="font-family:Arial, sans-serif; font-size:10px;width: 100%">
<tr>
<td colspan="10" class="BorderPadding05 FontSize10px">
<span class="FBold">DE (auteur de la facture)</span><br/>
</td>
<td colspan="5" class="BorderPadding05 FontSize10px">
<span class="FBold">A (Client)</span><br/>
</td>
<td colspan="5" class="BorderPadding05 FontSize10px">
<object type="image/barcode" style="width:50px;height:20px;" value="HERE THE MAPPING SHOULD PUT THE VALUE TO BE BARCODED" format="CODE_39"></object>
</td>
</tr>
</table>
</body>
Result will be as seen below
Example for Barcode generation in PDF message out
Note: The maximum filename supported for the PDF "Message Out" is 255 characters.