Ejemplo n.º 1
0
    //
    // 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);
        $printSize->height = $idealHeight;
        
    $idealWidth = $pdf->getPageWidth() - $margin[2] - $margin[3];
    if ($idealWidth < $printSize->width);
Ejemplo n.º 2
0
// 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) {
}
$printSize->height = $idealHeight;
$idealWidth = $pdf->getPageWidth() - $margin[2] - $margin[3];
if ($idealWidth < $printSize->width) {
}
Ejemplo n.º 3
0
    $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;
        $this->height = $height;
    }
}