Correct UTF8 outputs

This commit is contained in:
John Whitington 2022-01-04 17:17:37 +00:00
parent dface55e76
commit 249ce52e03
4 changed files with 6 additions and 6 deletions

View File

@ -136,7 +136,7 @@ let list_attached_files pdf =
| Some ((Pdf.Dictionary _) as d) -> | Some ((Pdf.Dictionary _) as d) ->
begin match Pdf.lookup_direct pdf "/F" d with begin match Pdf.lookup_direct pdf "/F" d with
| Some stream -> | Some stream ->
{name = x; {name = Pdftext.utf8_of_pdfdocstring x;
pagenumber = 0; pagenumber = 0;
data = data =
(fun () -> (fun () ->
@ -174,7 +174,7 @@ let list_attached_files pdf =
begin match Pdf.lookup_direct pdf "/F" d with begin match Pdf.lookup_direct pdf "/F" d with
| Some stream -> | Some stream ->
Some Some
{name = s; {name = Pdftext.utf8_of_pdfdocstring s;
pagenumber = pagenumber; pagenumber = pagenumber;
data = data =
(fun () -> (fun () ->
@ -190,7 +190,7 @@ let list_attached_files pdf =
end end
| _ -> | _ ->
Some Some
{name = s; {name = Pdftext.utf8_of_pdfdocstring s;
pagenumber = pagenumber; pagenumber = pagenumber;
data = (fun () -> raise (Pdf.PDFError "no attachment data"))} data = (fun () -> raise (Pdf.PDFError "no attachment data"))}
end end

Binary file not shown.

View File

@ -2395,7 +2395,7 @@ NB: For all imposition options, see also discussion of \texttt{-fast} in Section
\section{Listing Annotations} \section{Listing Annotations}
\index{annotations!listing} \index{annotations!listing}
The \texttt{-list-annotations} operation prints the textual content of any The \texttt{-list-annotations} operation prints the textual content of any
annotations on the selected pages to standard output. Each annotation is preceded by the page number and followed by a newline. See Section \ref{textencodings} for more information on text encodings in the output of this operation. annotations on the selected pages to standard output. Each annotation is preceded by the page number and followed by a newline. The output of this operation is always UTF8.
\begin{framed} \begin{framed}
\small\verb!cpdf -list-annotations in.pdf > annots.txt! \small\verb!cpdf -list-annotations in.pdf > annots.txt!
@ -3285,7 +3285,7 @@ In a PDF file, optional content groups are used to group graphical elements toge
\noindent\verb!cpdf -ocg-list in.pdf! \noindent\verb!cpdf -ocg-list in.pdf!
\end{framed}} \end{framed}}
\noindent List the optional content groups in the PDF, one per line, to standard output. \noindent List the optional content groups in the PDF, one per line, to standard output. UTF8.
{\small\begin{framed} {\small\begin{framed}
\noindent\verb!cpdf -ocg-rename -ocg-rename-from <a> -ocg-rename-to <b> in.pdf -o out.pdf! \noindent\verb!cpdf -ocg-rename -ocg-rename-from <a> -ocg-rename-to <b> in.pdf -o out.pdf!

View File

@ -96,7 +96,7 @@ let ocg_get_list pdf =
rev !l rev !l
let ocg_list pdf = let ocg_list pdf =
List.iter (Printf.printf "%s\n") (ocg_get_list pdf) List.iter (Printf.printf "%s\n") (map Pdftext.utf8_of_pdfdocstring (ocg_get_list pdf))
let ocg_rename f t pdf = let ocg_rename f t pdf =
Pdf.objselfmap Pdf.objselfmap