shobhitverma Posted May 29, 2018 Share Posted May 29, 2018 Hi, This post is regarding PS 1.6 I am generating invoices PDF, and the length of the invoice PDF is of 2 pages, and both the page have header and footer, but I don't want header from 2nd page onwards for which I tried the following code in \tools\tcpdf\tcpdf.php inside Startpage method nearly on line 4094 if($this->numpages == 1) $this->setHeader(); } It worked, and the header was not getting displayed from 2nd page onwards, but the issue is, it is still leaving margin space from the top of the 2nd page due to which a blank space is getting displayed on the 2nd page. For Resolving I tried the following code on classes\pdf\PDFGenerator.php inside the writePage method. nearly on line 217 if($this->numpages == 1){ $this->setMargins(10, 40, 10); } But by this, all page are getting affected. Any help will be appreciated. IN000009 (18).pdf Link to comment Share on other sites More sharing options...
tuk66 Posted June 15, 2018 Share Posted June 15, 2018 As of https://stackoverflow.com/questions/8810440/tcpdf-setmargins-method setMargins() method can be used before AddPage(). The question is if the TCPDF library supports margins on per-page level. For example the mPDFlibrary does. Link to comment Share on other sites More sharing options...
kavi_peiris Posted June 19, 2021 Share Posted June 19, 2021 @shobhitverma did you get a solution for this? Link to comment Share on other sites More sharing options...
kavi_peiris Posted June 20, 2021 Share Posted June 20, 2021 I found a solution for this. // Page footer public function Footer() { if ($this->page == 1) { $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); } } set margin back to normal on footer 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