[pmapper-users] pdf output other sizes than a4
Brought to you by:
arminburger
From: Florian G. <flo...@ma...> - 2007-06-28 15:57:46
|
hi all i wrote some functionality to also print pdfs as a3 not only a4. here are the diffs of the files i change if you would like to try it. diff for printdlg.phtml: --- printdlg.phtml 2007-06-28 23:37:38.000000000 +0800 +++ printdlg copy.phtml 2007-05-25 15:48:56.000000000 +0800 @@ -39,7 +39,7 @@ <html> <head> </head> -<body> +<body> <div style="padding-left:8px"> <form action="printmap.phtml" target="_blank" id="choosescale" method="get" > <table width="100%" border="0" cellspacing="1" cellpadding="2"> @@ -48,16 +48,13 @@ <tr><td><input type="checkbox" name="prefmap" value="on" checked /><?php echo (_p("With Overview Map"))?></td></tr> <tr><td><input type="checkbox" name="docformat" value="pdf" /><? php echo (_p("Create PDF Document"))?></td></tr> <tr><td><hr></td></tr> - <tr><td><input type="radio" name="pageSize" value="A4" checked="checked" /><?php echo (_p("Document Size (for PDF) A4"))?></ td></tr> - <tr><td><input type="radio" name="pageSize" value="A3" /><?php echo (_p("Document Size (for PDF) A3"))?></td></tr> - <tr><td><hr></td></tr> <tr><td><input type="button" value="<?php echo (_p("Create Print Page")) ?>" onclick="submit();$('#pmDlgContainer').hide()" /></ td></tr> </table> - <div> - <?php echo ("<input type=\"hidden\" name=\"" . ini_get ("session.name") . "\" value=\"" . session_id() . "\" />") ?> - <input type="hidden" name="config" value="<?php echo $_SESSION ['config'] ?>" /> + <div> + <?php echo ("<input type=\"hidden\" name=\"" . ini_get ("session.name") . "\" value=\"" . session_id() . "\" />") ?> + <input type="hidden" name="config" value="<?php echo $_SESSION ['config'] ?>" /> </div> - </form> + </form> </div> </body> </html> for printmap.phtml --- printmap.phtml 2007-06-28 22:20:33.000000000 +0800 +++ printmap copy.phtml 2007-05-17 17:36:15.000000000 +0800 @@ -56,11 +56,6 @@ $prefmap = false; } -if (isset($_REQUEST["pageSize"])) { - $pageSize = $_REQUEST["pageSize"]; -} else { - $pageSize = "A4"; -} // // Create PRINT PAGE: PDF or HTML @@ -68,7 +63,7 @@ // =====> PDF <===== if (isset($_REQUEST["docformat"])): - $pdf = new PDF($map, $prScale, 'P', 'pt', $pageSize, $pdfSettings, $prefmap); + $pdf = new PDF($map, $prScale, 'P', 'pt', 'A4', $pdfSettings, $prefmap); //Header('Pragma: public'); //header('Content-type: application/pdf'); $pdf->Output(); for pdfprint.php: --- pdfprint.php 2007-06-28 23:31:45.000000000 +0800 +++ pdfprint copy.php 2007-01-26 03:08:40.000000000 +0900 @@ -39,18 +39,8 @@ { $this->TCPDF($orientation,$units,$format,true); - if ($format == "A4") { - $mapW = 700; - $mapH = 530; - } elseif ($format == "A3") { - $mapW = 990; - $mapH = 1030; - } else { - $mapW = 700; - $mapH = 530; - } - - + $mapW = 700; + $mapH = 530; $this->pdfSettings = $pdfSettings; $this->prefmap = $prefmap; @@ -58,7 +48,7 @@ $printUrlList = $printMap->returnImgUrlList(); $this->initPDF($pdfSettings['author'], $pdfSettings ['pdftitle'], $pdfSettings['defFont'], $pdfSettings['defFontSize']); - $this->printPDF($map, $mapW, $mapH, $printUrlList, $prScale, $format); + $this->printPDF($map, $mapW, $mapH, $printUrlList, $prScale); $this->printScale(_p("Scale"), $prScale); $this->printLegendPDF($map, $prScale, 30, 500); } @@ -91,24 +81,15 @@ ***********************/ // MAIN PDF PAGE PTINTING - function printPDF($map, $pdfMapW, $pdfMapH, $printUrlList, $prScale, $format) + function printPDF($map, $pdfMapW, $pdfMapH, $printUrlList, $prScale) { $printmapUrl = $printUrlList[0]; $printrefUrl = $printUrlList[1]; $printsbarUrl = $printUrlList[2]; // Dimensions: A4 Portrait - if ($format == "A4") { - $pageWidth = 595; - $pageHeight = 842; - } elseif ($format == "A3") { - $pageWidth = 842; - $pageHeight = 1191; - } - else { - $pageWidth = 595; - $pageHeight = 842; - } + $pageWidth = 595; + $pageHeight = 842; // Reduction factor, calculated from PDF resolution (72 dpi) // reolution from map file and factor for increased map size for PDF output and i changed the hight of the print settings to 200 (up from 250). |