コード例 #1
0
ファイル: PlotAsPDF.php プロジェクト: kanbang/Colt
}
// Scale
if ($_POST["scaleDenominator"] && trim($_POST["scaleDenominator"]) != "") {
    $scale = intval($_POST["scaleDenominator"]);
} else {
    $scale = 500;
}
// Print size
if ($_POST["printSize"] && trim($_POST["printSize"]) != "") {
    $printSizeArray = explode(",", $_POST["printSize"]);
    $printSize = new Size(ParseLocaleDouble($printSizeArray[0]), ParseLocaleDouble($printSizeArray[1]));
} else {
    $printSize = new Size(0, 0);
}
if ($showLegend) {
    $legendWidth = PxToIn(250, $legendDpi);
}
// Create new PDF document, the default "PDF_UNIT" value is "mm"
$pdf = new TCPDF($orientation, PDF_UNIT, $paperType, true, "UTF-8", false);
$font = "dejavusans";
// Set margins
$pdf->SetMargins(0, 0, 0);
$pdf->SetHeaderMargin(0);
$pdf->SetFooterMargin(0);
// Prevent adding page automatically
$pdf->SetAutoPageBreak(false);
// Remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// Set default font size
$pdf->SetFont($font, "", 16, "", true);
コード例 #2
0
ファイル: PlotAsPDF.php プロジェクト: kanbang/Colt
// Scale
if ($_POST["scaleDenominator"] && trim($_POST["scaleDenominator"]) != "") {
    $scale = intval($_POST["scaleDenominator"]);
} else {
    $scale = 500;
}
// Print size
if ($_POST["printSize"] && trim($_POST["printSize"]) != "") {
    $printSizeArray = explode(",", $_POST["printSize"]);
    $printSize = new Size(ParseLocaleDouble($printSizeArray[0]), ParseLocaleDouble($printSizeArray[1]));
} else {
    $printSize = new Size(0, 0);
}
// Shave off width if we have a legend
if ($showLegend) {
    $legendWidth = PxToIn(250, $printDpi);
    $printSize->width = $printSize->width - $legendWidth;
}
// Construct the querysting which can be used to generate the Map image
$query_string = "session_id=" . $_POST['sessionId'] . "&map_name=" . $_POST['mapName'] . "&print_size=" . $printSize->width . "," . $printSize->height . "&print_dpi=" . $_POST['dpi'] . "&box=" . $_POST['box'] . "&normalized_box=" . $_POST['normalizedBox'] . "&scale_denominator=" . $_POST['scaleDenominator'] . "&rotation=" . $_POST['rotation'] . "&northarrow=" . ($showNorthArrow ? "1" : "0");
// Construct the querystring which can be used to generate the legend
if ($showLegend) {
    if (strcmp($legendType, "original") == 0) {
        $legend_query_string = "OPERATION=GETMAPLEGENDIMAGE&VERSION=1.0.0&FORMAT=PNG&SESSION=" . $_POST["sessionId"] . "&MAPNAME=" . $_POST["mapName"] . "&WIDTH=" . InToPx($legendWidth, $printDpi) . "&HEIGHT=" . InToPx($printSize->height, $printDpi);
    } else {
        $legend_query_string = "session_id=" . $_POST['sessionId'] . "&map_name=" . $_POST['mapName'] . "&width=" . InToPx($legendWidth, $printDpi) . "&height=" . InToPx($printSize->height, $printDpi);
    }
}
$filelocation = "";
$legendfilelocation = "";
if ("80" === $port) {