From ca8120006d259eae63c75a93a912d3e905c2b998 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Wed, 19 Sep 2018 11:56:08 -0400 Subject: [PATCH] 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. --- models/front/events/pdfCreator.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 ); + } } -- 2.17.1