$pdf->AddPage(); // The print size determines the size of the PDF, not the size of the map and legend images // we want to request back to put into this PDF. // // What that means is that we should draw the surrounding print elements first (title, scale, disclaimer), // then adjust the image request sizes to ensure they (and element drawn on top like coordinates) will fit // correctly in the remaining space. // // Title, scale and disclaimer rendering will all return Metrics objects that will give us the information // needed for the size adjustments // Draw Title $mTitle = DrawTitle(); $mScale = NULL; if ($showScaleBar) { // Draw Scale $mScale = DrawScale(); } // Draw declaration if ($showDisclaimer) { $mDec = DrawDeclaration($mScale != NULL ? $mScale->x + $mScale->w : 0); } else { $mDec = new Metrics(0, 0, 0, 0); } // Adjust width and height of the images we want to request to compensate for surrounding print elements that have been rendered // Check the size of the disclaimer and adjust height $idealHeight = $pdf->getPageHeight() - ($mDec->h - ($mScale != NULL ? $mScale->h : 0)) - $margin[0] - $margin[1]; //var_dump($idealHeight); //var_dump($printSize); //die; if ($idealHeight < $printSize->height) { }
$pdf->AddPage(); // Draw legend if specified if ($showLegend) { $pdf->Image($legendfilelocation, $margin[2], $margin[0], $legendWidth, $printSize->height, "PNG", "", "", false, $printDpi, "", false, false, 1, false, false, false); } // Draw Map first, so if the margin is not enough for the Text, the Text will be displayed about the image $pdf->Image($filelocation, $margin[2] + $legendWidth, $margin[0], $printSize->width, $printSize->height, "PNG", "", "", false, $printDpi, "", false, false, 1, false, false, false); // Draw Title DrawTitle(); if ($showCoordinates) { // Draw Extent coordinates DrawExtentCS(); } if ($showScaleBar) { // Draw Scale DrawScale(); } // Draw declaration DrawDeclaration(); // Close and output PDF document $pdf->Output($title . '.pdf', 'I'); ?> <?php class Size { public $width; public $height; public function __construct($width, $height) { $this->width = $width;