From 331121db38314cfb651ff5ab6b0560e86cdf1781 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Thu, 4 Jun 2015 13:35:56 +0100 Subject: [PATCH] Fix -upright to process pages which are already upright but which have a non-(0,0) origin --- cpdf.ml | 7 +++++-- cpdfmanual.pdf | Bin 216451 -> 216573 bytes cpdfmanual.tex | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cpdf.ml b/cpdf.ml index b883ea6..cc5e978 100644 --- a/cpdf.ml +++ b/cpdf.ml @@ -2389,10 +2389,13 @@ let select_pages range pdf = (* Upright functionality *) -(* If all pages are already upright, do nothing to save time. *) +(* If all pages are already upright, and the mediabox is (0,0)-based, do nothing +to save time. *) let allupright range pdf = let page_is_upright page = - page.Pdfpage.rotate = Pdfpage.Rotate0 + page.Pdfpage.rotate = Pdfpage.Rotate0 && + (let (minx, miny, _, _) = Pdf.parse_rectangle page.Pdfpage.mediabox in + minx < 0.001 && miny < 0.001 && minx > ~-.0.001 && miny > ~-.0.001) in not (mem false (map page_is_upright (select_pages range pdf))) diff --git a/cpdfmanual.pdf b/cpdfmanual.pdf index 0ac3669c828a1f9309c7726a3b8666a6439c7ae7..62919e983a0381fcb9b0887a3cf4aeeecd411b19 100644 GIT binary patch delta 5871 zcma)(Rag`bu(#=08U$(SZUmNwrE8Jy?pl_RT43oe1?fgf#ie8^=@M2-kyvSI>5@GE z@8-Kb=VqRn_jxa7<`-K;@=!#AV9dmlmd>s?;e%U@`!55@d+zwn11jqUh)sn?IjE-m z^S^O?<&>W0@NQyzL;PI${Blkywt;7{bc=%=Cv0%=0J8u0a`>~E+=(M4{z*W@ffo4L zH5N0avdXc{xx$^mLU_;P!LNo_;CVtC%4)~Vjly7f_dn>vRQChxn1t` z&NlU(Yj%GF)l1M;VWoFrk1oWvpX0` zUdh{QPwbw7ro@OowKv0!a=@;gIw>n}JN(v~Mrj^#NA?IFCeC7o3cCg9o3Q|#T5wv# zlizzCdpbg8#$G&g-^@m=eAEw~TycahK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