Location: PHPKode > projects > AppForMap > appformap/pdfcreate.php
<?php
/*
This notice must be untouched at all times.

AppForMap v. 0.4a
The latest version is available at
http://sourceforge.net/projects/appformap/

Copyright (c) 2003-2005 Martin Høgh. All rights reserved.
Created 17. 6. 2003 by Martin Høgh <hide@address.com>

This script can generate a pdf file from a map image.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

See the GNU General Public License
at http://www.gnu.org/copyleft/gpl.html for more details.
*/
if (sizeof($_POST) > 0)
{
	$HTTP_FORM_VARS = $_POST;
}
else
{
	if (sizeof($_GET) > 0)
	{
		$HTTP_FORM_VARS = $_GET;
	}
	else
	$HTTP_FORM_VARS = array("");
}
include_once("conf/load_modules.php");
include_once("conf/maplinkconfig.php");
$scale=$HTTP_FORM_VARS["scale"];
$scaleText=$HTTP_FORM_VARS["scaleText"];
$width_mm=$HTTP_FORM_VARS["width_mm"];
$height_mm=$HTTP_FORM_VARS["height_mm"];
$prop=$HTTP_FORM_VARS["prop"];
$orientation=$HTTP_FORM_VARS["orientation"];
$legendimageUrl=$HTTP_FORM_VARS["legendimageUrl"];
$mapimageUrl=$HTTP_FORM_VARS["mapimageUrl"];
$paper=$HTTP_FORM_VARS["paper"];
$text=$HTTP_FORM_VARS["text"];
$text2=$HTTP_FORM_VARS["text2"];
$scaleText=$scaleText.$scale;
if ($width_mm>0) $legendLeftMargin=$width_mm;
else $legendLeftMargin=$height_mm/$prop;
$legend_left_margin=
define('FPDF_FONTPATH','font/');
require('libs/fpdf/fpdf.php');
$pdf=new FPDF($orientation,"mm",$paper);
$pdf->AddPage();
$margins=10;
$pdf->SetFont('Arial','',10);
//Output justified text
$pdf->MultiCell(0,2,$scaleText);
//Line break
$pdf->Ln();
//Mention in italics
$pdf->SetFont('','I');
$pdf->Cell(0,5,$text);
$img=imagecreatefrompng($legendimageUrl);
$pdf->Image($mapimageUrl, $margins, $margins+10,$width_mm,$height_mm);
if ($layerXml!="") $pdf->Image($legendimageUrl,$legendLeftMargin+$margins+2, $margins+10, (imagesx($img)/4));
$pdf->SetY(-27);
$pdf->SetFont('Arial','',8);
$pdf->Cell(0,5,$text2);
$pdf->Output("map.pdf","D");
?> 
Return current item: AppForMap