pdf_template; } function setTemplate( $value ) { $this->pdf_template = $value; return true; } function getTemplatePages() { return $this->pdf_template_pages; } function setTemplatePages( $value ) { $this->pdf_template_pages = $value; return true; } function _outputPDF( $type ) { //Initialize PDF with template. $pdf = $this->getPDFObject(); if ( $this->getShowBackground() == true && $this->getTemplate() != '' ) { $pdf->setSourceFile( $this->getTemplate() ); for ( $i = 1; $i <= $this->getTemplatePages(); $i++ ) { $this->template_index[$i] = $pdf->ImportPage( $i ); } } $pdf->AddPage(); if ( isset( $this->template_index[1] ) ) { $pdf->useTemplate( $this->template_index[1], $this->getTemplateOffsets( 'x' ), $this->getTemplateOffsets( 'y' ) ); } $pdf->SetFont( $this->default_font, '', 4 ); //Red //$pdf->SetTextColor( 255, 0, 0 ); //$pdf->setDrawColor( 255, 0, 0 ); //Blue $pdf->SetTextColor( 0, 0, 255 ); $pdf->setDrawColor( 0, 0, 255 ); //Draw grid. $continue = true; $i = 0; $x = 0; $y = 0; $page = 1; while ( $continue && $i < 1000000 ) { $pdf->setXY( $x, $y ); $pdf->Cell( $this->grid_width, $this->grid_height, $x . 'x' . $y, 1, 0, 'L', 0 ); $x = $x + $this->grid_width; if ( $x > $pdf->getPageWidth() ) { $x = 0; $y = $y + $this->grid_height; } if ( $y > $pdf->getPageHeight() && $page < $this->getTemplatePages() ) { $page++; $pdf->AddPage(); $pdf->useTemplate( $this->template_index[$page], $this->getTemplateOffsets( 'x' ), $this->getTemplateOffsets( 'y' ) ); $x = 0; $y = 0; } else if ( $y > $pdf->getPageHeight() && $page == $this->getTemplatePages() ) { $continue = false; break; } $i++; } return true; } } ?>