Fix -upright to process pages which are already upright but which have a

non-(0,0) origin
This commit is contained in:
John Whitington 2015-06-04 13:35:56 +01:00
parent 08f7e14fab
commit 331121db38
3 changed files with 6 additions and 3 deletions

View File

@ -2389,10 +2389,13 @@ let select_pages range pdf =
(* Upright functionality *) (* 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 allupright range pdf =
let page_is_upright page = 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 in
not (mem false (map page_is_upright (select_pages range pdf))) not (mem false (map page_is_upright (select_pages range pdf)))

Binary file not shown.

View File

@ -792,7 +792,7 @@ ninety degrees clockwise. Does not change the page dimensions.
\label{upright} \label{upright}
\noindent The \texttt{-upright} operation does whatever combination of \noindent The \texttt{-upright} operation does whatever combination of
\texttt{-rotate} and \texttt{-rotate-contents} is required to change the \texttt{-rotate} and \texttt{-rotate-contents} is required to change the
rotation of the document to zero without altering its appearance. rotation of the document to zero without altering its appearance. In addition, it makes sure the media box has its origin at (0,0), changing other boxes to compensate.
\section{Flipping Pages} \section{Flipping Pages}
\index{flip pages} \index{flip pages}