Fix docs for -png -jpeg

This commit is contained in:
John Whitington 2023-06-01 19:10:06 +01:00
parent a2db6fcbbc
commit 6bb7106c84
3 changed files with 32 additions and 5 deletions

View File

@ -2031,7 +2031,7 @@ let set_input_image f s =
try try
let fh = open_in_bin s in let fh = open_in_bin s in
let pdf = image_of_input f (Pdfio.input_of_channel fh) in let pdf = image_of_input f (Pdfio.input_of_channel fh) in
try close_in fh with _ -> (); begin try close_in fh with _ -> () end;
args.original_filename <- s; args.original_filename <- s;
args.create_objstm <- true; args.create_objstm <- true;
args.inputs <- (AlreadyInMemory pdf, "all", "", "", ref false, None)::args.inputs args.inputs <- (AlreadyInMemory pdf, "all", "", "", ref false, None)::args.inputs

Binary file not shown.

View File

@ -3954,6 +3954,12 @@ In a PDF file, optional content groups are used to group graphical elements toge
\noindent\verb!cpdf -typeset <text file> [-create-pdf-papersize <size>]!\\ \noindent\verb!cpdf -typeset <text file> [-create-pdf-papersize <size>]!\\
\noindent\verb! [-font <font>] [-font-size <size>] -o out.pdf! \noindent\verb! [-font <font>] [-font-size <size>] -o out.pdf!
\vspace{1.5mm}
\noindent\verb!cpdf -jpeg <filename> -o out.pdf]!
\vspace{1.5mm}
\noindent\verb!cpdf -png <filename> -o out.pdf!
\end{framed}} \end{framed}}
\section{A new blank PDF} \section{A new blank PDF}
@ -3962,8 +3968,8 @@ In a PDF file, optional content groups are used to group graphical elements toge
We can build a new PDF file, given a number of pages and a paper size. The default is one page, A4 portrait. We can build a new PDF file, given a number of pages and a paper size. The default is one page, A4 portrait.
\begin{framed} \begin{framed}
\small\verb?cpdf -create-pdf -create-pdf-pages 20?\\ \noindent\small\verb?cpdf -create-pdf -create-pdf-pages 20?\\
\noindent\small\verb? -create-pdf-papersize usletterportrait -o out.pdf? \noindent\small\verb? -create-pdf-papersize usletterportrait -o out.pdf?
\end{framed} \end{framed}
\noindent The standard paper sizes are listed in Section \ref{papersizes}, or you may specify the width and height directly, as described in the same chapter. \noindent The standard paper sizes are listed in Section \ref{papersizes}, or you may specify the width and height directly, as described in the same chapter.
@ -3973,12 +3979,33 @@ We can build a new PDF file, given a number of pages and a paper size. The defau
A basic text to PDF convertor is included in \texttt{cpdf}. It takes a UTF8 text file (ASCII is a subset of UTF8) and typesets it ragged-right, splitting on whitespace. Both Windows and Unix line endings are allowed. A basic text to PDF convertor is included in \texttt{cpdf}. It takes a UTF8 text file (ASCII is a subset of UTF8) and typesets it ragged-right, splitting on whitespace. Both Windows and Unix line endings are allowed.
\begin{framed} \begin{framed}
\small\verb?cpdf -typeset file.txt -create-pdf-papersize a3portrait?\\ \noindent\small\verb?cpdf -typeset file.txt -create-pdf-papersize a3portrait?\\
\noindent\small\verb? -font Courier -font-size 10 -o out.pdf? \noindent\small\verb? -font Courier -font-size 10 -o out.pdf?
\end{framed} \end{framed}
\noindent The standard paper sizes are listed in Section \ref{papersizes}, or you may specify the width and height directly, as described in the same chapter. The standard fonts are listed in chapter~\ref{chap:8}. The default font is TimesRoman and the default size is 12. \noindent The standard paper sizes are listed in Section \ref{papersizes}, or you may specify the width and height directly, as described in the same chapter. The standard fonts are listed in chapter~\ref{chap:8}. The default font is TimesRoman and the default size is 12.
\section{Make a PDF from a PNG or JPEG image}
\index{image!convert to PDF}
Simple facilities for making PDFs from PNG and JPEG images are included in \texttt{cpdf}. The resulting file can be written out, or used for further operations.
For PNG files, the file must be 24bit RGB with no transparency and no interlacing.
\begin{framed}
\noindent\small\verb?cpdf -png image.png -o out.pdf?\\
\noindent\small\verb?cpdf -png image.png AND -add-text "My Image" -o out.pdf?
\end{framed}
\noindent Almost any JPEG file may be used:
\begin{framed}
\noindent\small\verb?cpdf -jpeg image.jpg -o out.pdf?
\end{framed}
\noindent The output file will have one point of width or height for each pixel in the input.
\begin{cpdflib} \begin{cpdflib}
\clearpage \clearpage
\section*{C Interface} \section*{C Interface}