Fix semantics (and documentation) for -newpage

This commit is contained in:
John Whitington 2023-10-18 15:18:18 +01:00
parent 131a7a0060
commit d161ec3b21
3 changed files with 8 additions and 3 deletions

View File

@ -435,7 +435,12 @@ let draw ?(fast=false) ?(underneath=false) ~filename ~bates ~batespad range pdf
if hd !chunks <> [] then pdf := draw_single ~fast ~underneath ~filename ~bates ~batespad fast !range !pdf (hd !chunks);
chunks := tl !chunks;
if !chunks <> [] then begin
(* If the range is just a single page, and there is a next page, move to it. Otherwise,
add a blank page at the end of the document. *)
let endpage = Pdfpage.endpage !pdf in
match !range with
| [x] when endpage > x -> range := [x + 1]
| _ ->
pdf := Cpdfpad.padafter [endpage] !pdf;
range := [endpage + 1]
end

Binary file not shown.

View File

@ -4619,7 +4619,7 @@ NB: To use \texttt{-embed-std14}, put it before \texttt{-draw}.
\noindent\verb!-newpage! Move to a fresh page
\end{framed}}
The drawing operation \texttt{-newpage} creates a fresh page of the same dimensions as the last page of the document, and sets the drawing range to just that page. For example:
If the drawing range is a single page, and the next page already exists, the drawing operation \texttt{-newpage} operation moves to the next page. Otherwise, it creates a fresh page of the same dimensions as the last page of the document, and sets the drawing range to just that page. For example:
\begin{framed}
\noindent\small\verb?cpdf -create-pdf AND -draw -bt -text "Page 1" -et?\\