Jump to content

Multipage Pdf Invoices...


whoey

Recommended Posts

Hey all,

 

Recently discovered Prestashop, and worked with a client to setup a Prestashop 1.4.6.2 shop.

 

While I know most webshops don't have orders of over 25 items, via a dealer order we quickly discovered that multipage PDF Invoices do not render correctly. We found that by making a few edits to /classes/PDF.php we could get multipage PDF invoices with no overlapping... Thought we'd share it with you all.

 

Our solution is to check the current line location rather than use a counter (not all items are single line!)

 

here is a diff from our PDF.php and the default:

 

682,690d681
<
<					   //patched to jump to next page at certain point. prevents price summation to write into footer.
<					   $y2value = $pdf->GetY();
<					   if ($y2value >= 210)
<					   {
<							   $pdf->AddPage();
<							   $pdf->Ln();
<					   }
<
820a812,813
>			   $counter = 0;
>			   $lines = 25;
827,828c820
<							   $yvalue = $this->GetY();
<							   if ($yvalue >= 240)
---
>							   if ($counter >= $lines)
833a826,827
>									   $counter = 0;
>									   $lines = 40;
835a830
>							   $counter = $counter + ($lineSize / 5) ;

 

Hope you find it useful, and maybe they can commit this!

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...