Jump to content

Custom PDF


Recommended Posts

et donc je souhaiterai pouvoir modifier la taille du header et du footer du PDF que je génère à partir de mon module

J'ai essayé de d'utiliser $this->setMargins() dans ma class HTMLTemplateCustomPdf qui génère mon PDF mais ça ne marche pas

 

merci

 

I can try in english If you prefer  :

my problem is to change footer's and header's height of my PDF that I create from a personal module 

i have create my PDF with this method : http://blog.belvg.com/pdf-in-prestashop.html

but i can't find how to change the footer's or header's height

I have try to use $this->setMargins() in my class HTMLTemplateCustomPdf, but it doesn't work

thanks

Link to comment
Share on other sites

I think that page is not about a new module. It just replaces HTMLTemplate class and calls PDF class to create the document. I wrote about PDFGenerator class, and it looks like this class is untouched in that code.

Link to comment
Share on other sites

J'ai enfin compris comment il faut faire ...

il faut tout simplement faire un override de la classe PDFGenerator

 

Il faut donc créer PDFGenerator.php dans monmodule/override/classes/pdf/

<?php
class PDFGenerator extends PDFGeneratorCore
{
    /**
     * Write a PDF page
     */
    public function writePage()
    {
        $this->SetHeaderMargin(5);
        $this->SetFooterMargin(30);
        $this->setMargins(10, 40, 10);
        $this->SetAutoPageBreak(true, 35);
        $this->AddPage();
        $this->writeHTML($this->content, true, false, true, false, '');
    }
}

et voilà !

à l'installation du module, il fait une copie du fichier dans override/classes/pdf/ et du coup ça marche :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...