How to remove the page number from a Report PDF

Is it possible to remove the page number on the PDF that is generated when a user selects "Print as PDF" on a report? These reports are normally added to a much larger packet and the Sugar page number has to then be manually removed. We don't use pdfs in Sugar so if we had to remove the entire footer that would be a viable option as well.

Sugar Version - Professional 10.0.4

Any help would be great!

Thanks,

Dan

Parents
  • Dan,

    Firstly, I have not tested any of the following, it is just gleaned from knowing the pdf manager class. I might be able to point you in the right direction though.

    I think you are asking here where you can find the setting to switch off the footer. The actual place the footer output is set is in the core TCPDF class and a function called "Footer()" - which can be overridden to remove or adjust content. However, the output of it is also controlled with a function called: "setPrintFooter". This function can be used in your class to just switch off the footer from being printed out at all.

    Sugar uses the Sugarpdf class to extend the core TCPDF one and that provides further classes to create custom PDF templates for specific modules by adding them to the sugarpdf directory under the module. I think the one we end up looking for is SugarpdfPdfmanager.

    The setPrintFooter function is called as part of the override of the "preDisplay in the SugarpdfPdfmanager class and so you probably need to override the preDisplay function in a custom class to alter it.

    As you are working with Reports I think you need to look in the "./modules/Reports/sugarpdf" directory for the clues. In there you will find several files that set up the layouts for the various elements that make up a download report PDF file. The "preDisplay" function is called in the file: "sugarpdf.reports.php" and so I think you need to be looking to create a custom version of that file and add the line:

    $this->setPrintFooter(false);

    after the call to:

    parent::preDisplay();

    I think that the PDF manager classes are handled by the AutoLoader and so you *should* be able to create a custom version of that file by copying it to:

    ./custom/modules/Reports/sugarpdf/sugarpdf.reports.php

    and making the adjustment in there.

    As I said, none of this is tested. I am just trying to make suggestions. Hopefully you should be able to follow forwards and get on the right track though.

    Good luck Slight smile

    Thanks,

    JH.

Reply
  • Dan,

    Firstly, I have not tested any of the following, it is just gleaned from knowing the pdf manager class. I might be able to point you in the right direction though.

    I think you are asking here where you can find the setting to switch off the footer. The actual place the footer output is set is in the core TCPDF class and a function called "Footer()" - which can be overridden to remove or adjust content. However, the output of it is also controlled with a function called: "setPrintFooter". This function can be used in your class to just switch off the footer from being printed out at all.

    Sugar uses the Sugarpdf class to extend the core TCPDF one and that provides further classes to create custom PDF templates for specific modules by adding them to the sugarpdf directory under the module. I think the one we end up looking for is SugarpdfPdfmanager.

    The setPrintFooter function is called as part of the override of the "preDisplay in the SugarpdfPdfmanager class and so you probably need to override the preDisplay function in a custom class to alter it.

    As you are working with Reports I think you need to look in the "./modules/Reports/sugarpdf" directory for the clues. In there you will find several files that set up the layouts for the various elements that make up a download report PDF file. The "preDisplay" function is called in the file: "sugarpdf.reports.php" and so I think you need to be looking to create a custom version of that file and add the line:

    $this->setPrintFooter(false);

    after the call to:

    parent::preDisplay();

    I think that the PDF manager classes are handled by the AutoLoader and so you *should* be able to create a custom version of that file by copying it to:

    ./custom/modules/Reports/sugarpdf/sugarpdf.reports.php

    and making the adjustment in there.

    As I said, none of this is tested. I am just trying to make suggestions. Hopefully you should be able to follow forwards and get on the right track though.

    Good luck Slight smile

    Thanks,

    JH.

Children