diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 1fff3ac..c3d80d6 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -3381,8 +3381,8 @@ let collate (names, pdfs, ranges) = split3 (rev !nis) let warn_prerotate range pdf = - if not args.prerotate && not (Cpdfpage.allupright range pdf) then - Pdfe.log "Some pages in the range have non-zero rotation or non (0,0)-based mediabox. \ + if not args.prerotate && not (Cpdfpage.alluprightonly range pdf) then + Pdfe.log "Some pages in the range have non-zero rotation. \ Consider adding -prerotate or pre-processing with -upright. \ To silence this warning use -no-warn-rotate\n" diff --git a/cpdfmanual.tex b/cpdfmanual.tex index d9844c6..b0c906e 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -17,6 +17,8 @@ %Document -obj - check enc %Document -merge-no-struct-trees in merge and collate %Document -shift-boxes +%Document that -scale-to-fit prefers the cropbox +%Document in -scale-to-fit that hardbox exists %Document that -scale-to-fit may have -top bottom left right \documentclass{book} % Edit here to produce cpdfmanual.pdf, cpdflibmanual.pdf, pycpdfmanual.pdf, diff --git a/cpdfpage.ml b/cpdfpage.ml index 6140479..4086d97 100644 --- a/cpdfpage.ml +++ b/cpdfpage.ml @@ -409,6 +409,12 @@ let allupright range pdf = in not (mem false (map page_is_upright (select_pages range pdf))) +(* Same, but don't care about mediabox origin. This is for -scale-to-fit, now that +it is ok with nonzero origins. *) +let alluprightonly range pdf = + let page_is_upright page = page.Pdfpage.rotate = Pdfpage.Rotate0 in + not (mem false (map page_is_upright (select_pages range pdf))) + let upright_transform pdf page = let rotate = Pdfpage.int_of_rotation page.Pdfpage.rotate diff --git a/cpdfpage.mli b/cpdfpage.mli index b445fae..220a369 100644 --- a/cpdfpage.mli +++ b/cpdfpage.mli @@ -116,5 +116,8 @@ val copy_box : string -> string -> bool -> Pdf.t -> int list -> Pdf.t (** True if all pages are "upright" i.e no rotation and (0,0)-based. *) val allupright : int list -> Pdf.t -> bool +(** True if all pages are "upright" i.e no rotation. *) +val alluprightonly : int list -> Pdf.t -> bool + (** When a page is transformed, its patterns must be too. *) val change_pattern_matrices_page : Pdf.t -> Pdftransform.transform_matrix -> Pdfpage.t -> Pdfpage.t