From 84c74e5ce24d64b530640e30555765931a7f818b Mon Sep 17 00:00:00 2001 From: John Whitington Date: Sun, 3 Apr 2022 11:31:36 +0200 Subject: [PATCH] UTF8 @B bookmarks on split --- Changes | 4 ++++ cpdfattach.ml | 1 + cpdfcommand.ml | 4 ++-- cpdfmanual.tex | 4 +++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index ebf1a76..0994d54 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +2.6 (next version, to come) + +o Allow -utf8 with -split-bookmarks -o @B.pdf to produce UTF8 filenames + 2.5.1 (January 2022) o Fix a regression where standard fonts could not be chosen diff --git a/cpdfattach.ml b/cpdfattach.ml index 80e16ec..a2066c7 100644 --- a/cpdfattach.ml +++ b/cpdfattach.ml @@ -4,6 +4,7 @@ open Cpdferror (* Remove characters which might not make good filenames. *) let remove_unsafe_characters encoding s = + if encoding = Cpdfmetadata.UTF8 then Pdftext.utf8_of_pdfdocstring s else (* For @B bookmarks splitting. *) if encoding = Cpdfmetadata.Raw then s else let chars = lose diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 6610241..3b68812 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -2,8 +2,8 @@ let demo = false let noncomp = false let major_version = 2 -let minor_version = 5 -let version_date = "(patchlevel 1, 31st Jan 2022)" +let minor_version = 6 +let version_date = "(devel, 3 April 2022)" open Pdfutil open Pdfio diff --git a/cpdfmanual.tex b/cpdfmanual.tex index bae7fd8..99f5f61 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -1026,7 +1026,7 @@ cpdf -merge in1.pdf [] in2.pdf [] [] \noindent\verb!cpdf -split in.pdf -o [-chunk ]! \vspace{1.5mm} - \noindent\verb!cpdf -split-bookmarks in.pdf -o ! + \noindent\verb!cpdf -split-bookmarks in.pdf [-utf8] -o ! \end{framed} \vspace{12mm} @@ -1141,6 +1141,8 @@ one of the output files. \verb! / ? < > \ : * | " ^ + =! \end{framed} + To prevent this process, and convert bookmark names to UTF8 instead, add \texttt{-utf8} to the command. + \section{Encrypting with Split and Split Bookmarks} \index{encryption} The encryption parameters described in Chapter \ref{encryption} may be added to the command line to encrypt each split PDF. Similarly, the \texttt{-recrypt} switch described in Chapter \ref{basicusage} may by given to re-encrypt each file with the existing encryption of the source PDF.