Guides

  • Put a background image on the pdf

    Posted on May 23, 2012 by ext4mage

    Want to have an image as the background of the PDF

    If you want to set an image as the background of the complete PDF, this can be done by doing it this way. First of be clear that this will overwrite the header function.

    In the file lib/ext4magehtml2pdf/ext4magehtml2pdf.php find the method Header() and put in the code below

    $this->SetAutoPageBreak(false);
    $img_file = Mage::getBaseDir('media') . DS . 'wysiwyg' . DS . 'briefpapier.jpg';
    $this->Image($img_file, 0, 0, 210, 297, '', '', '', 2, 300, '', false, false, 0);
    $this->setPageMark();
    $this->SetAutoPageBreak(true, 30);
    

    Related product:
      HTML2PDF extension


    This post was posted in Guides and was tagged with magento, design, pdf layout

  • Add a due date on the invoice pdf

    Posted on May 23, 2012 by ext4mage

    Want to add a date that is x days from invoice date to the invoice PDF

    If you have a need to print a date to your invoice, order, shipping or creditmememo PDF, that is based on a variable date and then x days in the future. This is then a solution to do this in the HTML2PDF module text element.

    Example:
    Due date (invoice date + 14 days) - you can do this like this (formatted with data medium - look in help->formatting)

    ##format_date_medium date( 'Y-m-d H:i:s' , strtotime ( '+14 day' , strtotime ('{{invoice_data_created_at}}')))##
     
     

    Related product:
      HTML2PDF extension


    This post was posted in Guides and was tagged with html2pdf, magento, design, pdf layout

  • Show a Magento block based on variable

    Posted on May 23, 2012 by ext4mage

    Want to show a Magento block in PDF based on a variable

    In the PDF you want to show a Magento block element, if the value of a specific variable is something. Below is the code that shall be put into the text element in you PDF template.

    First we test if a variable (order_payment_data_method) is equal a text (installment), if it is do nothing, if it is not print something (<span style="display: none;">). Then we reference the block that we want to show (Magento style). Last we test again and prints something if not equal (</span>)

    ##strstr({{order_payment_data_method}}, 'installment') ? '' : ''##
        {{ block id="paysolution_pdf" }}
    ##strstr({{order_payment_data_method}}, 'installment') ? '' : ''##
    

    Related product:
      HTML2PDF extension


    This post was posted in Guides and was tagged with magento, block, invoice layout, design

3 Item(s)