. BookReaderPrint.php exists to get around the same-origin policy that prevents us from calling print() on an iframe that comes from a cluster datanode. */ $id = $_REQUEST['id']; $server = $_REQUEST['server']; $zip = $_REQUEST['zip']; $file = $_REQUEST['file']; $format = $_REQUEST['format']; //$imgAspect = $_REQUEST['aspect']; $width = floatval($_REQUEST['width']); $height = floatval($_REQUEST['height']); $title = $_REQUEST['title']; /* We assume that the print aspect ratio is somewhat close to US Letter in portrait orientation */ $paperAspect = 8.5/11; // $$$ may want to adjust this if two page with foldout looks strange $allowRotate = true; // Returns (url, attrs) function imageURL($paperAspect, $file, $format, $width, $height, $allowRotate) { global $server, $id, $zip; $rotate = "0"; $imgAspect = $width / $height; if ('jp2' == $format && $allowRotate) { // Rotation is possible if ($imgAspect > $paperAspect && $imgAspect > 1) { $rotate = "90"; $imgAspect = 1 / $imgAspect; } } if ($imgAspect > $paperAspect) { // wider than paper, fit width $htmlAttrs = "width='95%'"; } else { // taller than paper, fit height $htmlAttrs = "height='95%'"; } $queryParams = array( 'id' => $id, // global 'format' => $format, 'index' => $index, 'file' => $file, 'zip' => $zip, // global 'rotate' => $rotate, 'scale' => 1 ); $_server = htmlspecialchars($server); return ""; } echo ""; echo ''; echo ""; echo ""; echo "" . htmlspecialchars($title) . ""; echo "

"; echo " Print

"; echo "

"; echo imageURL($paperAspect, $file, $format, $width, $height, $allowRotate); echo "

"; if (isset($_REQUEST['file2'])) { $file2 = $_REQUEST['file2']; $width2 = floatval($_REQUEST['width2']); $height2 = floatval($_REQUEST['height2']); echo "

"; echo imageURL($paperAspect, $file2, $format, $width2, $height2, $allowRotate); echo "

"; } echo ""; ?>