From: Steve Sutton Date: Wed, 19 Sep 2018 15:56:08 +0000 (-0400) Subject: Wrap dates in pdf and setup the bottom of pdf pages. X-Git-Tag: v1.7.0^2~7 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=ca8120006d259eae63c75a93a912d3e905c2b998;p=WP-Plugins%2Fglm-member-db-events.git Wrap dates in pdf and setup the bottom of pdf pages. For bottom of pdf pages need to check if too close so we can goto new page. Wrap the dates part so it won't go over the Title. --- diff --git a/models/front/events/pdfCreator.php b/models/front/events/pdfCreator.php index 6ee1a15..de0ef0b 100644 --- a/models/front/events/pdfCreator.php +++ b/models/front/events/pdfCreator.php @@ -18,6 +18,7 @@ $this->line_height = 10; $this->pdf_font_size = 8; $this->pdf_lft_col_x = 20; $this->pdf_rgt_col_x = 320; +$this->pdf_bottom_y = 200; usort( $events, function($event1, $event2){ if ( $event1['starting_timestamp'] == $event2['starting_timestamp']) { @@ -101,7 +102,7 @@ foreach ( $events as $eventId => $event ) { } } // Add the Event Dates - $event_date_y = $pdf->ezText( ''.$eventDates.'', $this->pdf_font_size, array( 'aleft' => $this->pdf_lft_col_x ) ); + $event_date_y = $pdf->ezText( ''.$eventDates.'', $this->pdf_font_size, array( 'aleft' => $this->pdf_lft_col_x, 'aright' => $this->pdf_rgt_col_x ) ); // title $pdf->ezSetY( $eventTopY ); @@ -209,6 +210,12 @@ foreach ( $events as $eventId => $event ) { // bottom $pdfY = $pdf->y; + // If the $pdf->y is too close to the bottom then start next page. + if ( $pdf->y < $this->pdf_bottom_y && !( $totalEvents == $index ) ) { + $pdf->ezNewPage(); + $pdfY = $this->pdf_top_y; + $pdf->ezSetY( $pdfY ); + } }