JuanTomas Posted March 16, 2016 Share Posted March 16, 2016 (edited) Solved by tuk66, the solution is to modify the top margin which is set in classes/pdf/PDFGenerator.php, function writepage(). Here the relevant line: $this->setMargins(10, 40, 10); The second argument (40) is the top margin for the main content. By increasing this margin, the main content is rendered lower down on the page so it doesn't overlap with the header. Original post follows: _______________________________________ Using PrestaShop 1.6.1.2 I've added a "job card" feature to my PrestaShop, for internal use by the company. It's similar to an invoice but with different information. It renders as a PDF, just like the invoice. Override class is override/classes/pdf/HTMLTemplateJobCard.php (derived from classes/pdf/HTMLTemplateInvoice.php). The header template is this: <table style="width: 100%"><tr> <td style="width: 50%"> {if $logo_path} <img src="{$logo_path}" style="width:{$width_logo}px; height:{$height_logo}px;" /> {/if} </td> <td style="width: 50%; text-align: left;"> <table style="width: 100%"> <tr> <td style="font-weight: bold; font-size: 14pt; color: #444; width: 100%;"><h1>Job Work Order</h1></td> </tr> <tr><td> </td></tr> <tr> <td style="font-weight: bold; font-size: 14pt; color: #444; width: 100%;">Reference: {$order_reference}</td> </tr> </table> </td></tr><tr> <td> <table> <tr><td style="width: 25%; text-align:left;">Order Date:</td><td style="width: 75%; text-align:left;">{$invoice_date}</td></tr> <tr><td style="width: 25%; text-align:left;">Due Date:</td><td style="width: 75%; text-align:left;">{$delivery_date}</td></tr> <tr><td style="width: 25%; text-align:left;">Send Bill To:</td><td style="width: 75%; text-align:left;">{$address_delivery}</td></tr> <tr><td style="width: 25%; text-align:left;">Ship To:</td><td style="width: 75%; text-align:left;">{$address_invoice}</td></tr> <tr><td style="width: 25%; text-align:left;">Phone:</td><td style="width: 75%; text-align:left;">{$phone}</td></tr> <tr><td style="width: 25%; text-align:left;">Email:</td><td style="width: 75%; text-align:left;">{$email}</td></tr> </table> </td></tr></table> The content template is this: <table width="100%" id="body" border="0" cellpadding="0" cellspacing="0" style="margin:0;"> <!-- Product --> <tr> <td colspan="2" align="center">Reference</td> <td colspan="1" align="center">Qty</td> <td colspan="1" align="center">Qty In Stock</td> <td colspan="6" align="center">Product</td> <td colspan="2" align="center">Unit Price</td> </tr> {foreach from=$details item=det} <tr> <td colspan="2">{$det.reference}</td> <td colspan="1">{$det.quantity}</td> <td colspan="1">{$det.quantity_in_stock}</td> <td colspan="6">{$det.product_name}</td> <td colspan="2" align="right">{$det.price}</td> </tr> <tr><td colspan=12> </td></tr> {/foreach}</table> There is no footer template (getFooter() returns empty string). Both the header and the content render correctly. Trouble is, they're superimposed: the top line of the content renders at the same place as "Ship To" in the header. Any insights will be greatly appreciated! Edited March 18, 2016 by JuanTomas (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted March 16, 2016 Share Posted March 16, 2016 Try to change $this->setMargins(10, 40, 10); in the /classes/pdf/PDFGenerator.php file. Link to comment Share on other sites More sharing options...
JuanTomas Posted March 18, 2016 Author Share Posted March 18, 2016 You nailed it, tuk66! Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now