X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fcups.git;a=blobdiff_plain;f=pdftops%2FPSOutputDev.cxx;h=18b893c37d256a153279df3c0273241775a2ed12;hp=15d371fda4908d4a7c051ea9c3e4fb44acd3f356;hb=b94498cfba64422f0f21181b0c51cc0bed7c7d92;hpb=323c5de1e804061e344172cc9a9551bb0ee71005 diff --git a/pdftops/PSOutputDev.cxx b/pdftops/PSOutputDev.cxx index 15d371fda..18b893c37 100644 --- a/pdftops/PSOutputDev.cxx +++ b/pdftops/PSOutputDev.cxx @@ -2511,17 +2511,20 @@ GBool PSOutputDev::startPage(int pageNum, GfxState *state) { landscape = gFalse; } else { rotate = (360 - state->getRotate()) % 360; + + fprintf(stderr, "DEBUG: Page rotate=%d, width=%d, height=%d, imgWidth=%d, imgHeight=%d\n", + state->getRotate(), width, height, imgWidth, imgHeight); + + rotate = (360 - state->getRotate()) % 360; if (rotate == 0 || rotate == 180) { - if ((width > height && imgWidth < imgHeight) || - (height > width && imgHeight < imgWidth)) { + if (width > height && width > imgWidth) { rotate += 90; landscape = gTrue; } else { landscape = gFalse; } } else { // rotate == 90 || rotate == 270 - if ((width > height && imgWidth < imgHeight) || - (height > width && imgHeight < imgWidth)) { + if (height > width && height > imgWidth) { rotate = 270 - rotate; landscape = gTrue; } else { @@ -2529,6 +2532,7 @@ GBool PSOutputDev::startPage(int pageNum, GfxState *state) { } } } + writePSFmt("%%%%PageOrientation: %s\n", landscape ? "Landscape" : "Portrait"); writePS("pdfStartPage\n");