-create-pdf-ua-1 added
This commit is contained in:
parent
f37b47ea77
commit
70f201a653
2
Changes
2
Changes
|
@ -7,7 +7,7 @@ o Removed setting of Producer field in AGPL version
|
|||
* New -args-json for better control files
|
||||
* New -replace-obj to edit dictionary entries via chain
|
||||
* Create structure information for files with -draw
|
||||
* Create PDF/UA files from scratch
|
||||
* Create PDF/UA files from scratch with -create-pdf-ua1
|
||||
|
||||
* = Supported by a grant from NLnet
|
||||
|
||||
|
|
|
@ -2616,6 +2616,9 @@ let specs =
|
|||
("-create-pdf",
|
||||
Arg.Unit (setop CreatePDF),
|
||||
" Create a new PDF");
|
||||
("-create-pdf-ua-1",
|
||||
Arg.String (fun _ -> ()), (* Processed elsewhere *)
|
||||
" Create a new PDF/UA-1 with the new title");
|
||||
("-create-pdf-pages",
|
||||
Arg.Int setcreatepdfpages,
|
||||
" Number of pages for new PDF");
|
||||
|
@ -4604,6 +4607,14 @@ let expand_args argv =
|
|||
let l = Array.to_list argv in
|
||||
Array.of_list (expand_args_inner [] l)
|
||||
|
||||
let rec expand_recipes = function
|
||||
| [] -> []
|
||||
| "-create-pdf-ua-1"::title::t -> Cpdfua.cpdfua_args title @ expand_recipes t
|
||||
| h::t -> h::expand_recipes t
|
||||
|
||||
let expand_recipes argv =
|
||||
Array.of_list (expand_recipes (Array.to_list argv))
|
||||
|
||||
let gs_malformed_force fi fo =
|
||||
if args.path_to_ghostscript = "" then begin
|
||||
Pdfe.log "Please supply path to gs with -gs\n";
|
||||
|
@ -4644,6 +4655,8 @@ let go_withargv argv =
|
|||
if demo then
|
||||
flprint "This demo functions normally, but is for evaluation only. https://www.coherentpdf.com/\n";
|
||||
try
|
||||
(* Pre-expands recipes like -create-pdf-ua-1 *)
|
||||
let argv = expand_recipes argv in
|
||||
(* Pre-expand -args *)
|
||||
let argv = expand_args argv in
|
||||
(* Split the arguments into sets either side of ANDs *)
|
||||
|
|
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
|
@ -4482,6 +4482,7 @@ In a PDF file, optional content groups are used to group graphical elements toge
|
|||
\noindent\verb!cpdf -create-pdf [-create-pdf-pages <n>]!\\
|
||||
\noindent\verb! [-create-pdf-papersize <paper size>] -o out.pdf!
|
||||
|
||||
|
||||
\vspace{1.5mm}
|
||||
\noindent\verb!cpdf -typeset <text file> [-create-pdf-papersize <size>]!\\
|
||||
\noindent\verb! [-font <font>] [-font-size <size>] -o out.pdf!
|
||||
|
@ -5197,6 +5198,10 @@ If the drawing range is a single page, and the next page already exists, the dra
|
|||
\vspace{1.5mm}
|
||||
\noindent\verb!cpdf -remove-mark ["PDF/UA-1" | "PDF/UA-2"] in.pdf -o out.pdf!
|
||||
|
||||
\vspace{1.5mm}
|
||||
\noindent\verb!cpdf [-create-pdf-pages <n>] [-create-pdf-papersize <paper size>]!\\
|
||||
\noindent\verb! -create-pdf-ua-1 <title> -o out.pdf!
|
||||
|
||||
\end{framed}}
|
||||
|
||||
PDF/UA (Universal Accessibility) is a PDF subformat whose rules consist of a set of machine-checkable and human-checkable-only requirements to make PDF documents accessible for all users - for example, those using screen readers. Cpdf has some basic facilities for manipulating the extra PDF constructs which are used in (amongst others) PDF/UA, and a basic verifier for many of the machine-checkable requirements.
|
||||
|
@ -5408,10 +5413,20 @@ Once we are sure a file complies to PDF/UA, in terms of both machine and human c
|
|||
\noindent\small\verb!cpdf -remove-mark "PDF/UA-1" in.pdf -o out.pdf!
|
||||
\end{framed}
|
||||
|
||||
\section{Merging and splitting PDF/UA files}.
|
||||
\section{Merging and splitting PDF/UA files}
|
||||
|
||||
\noindent The \texttt{-process-struct-trees} option should always be used in conjunction with any splitting or merging command to preserve PDF/UA compliance. Details are given in chapter \ref{chap:2}.
|
||||
|
||||
\section{Creating new PDF/UA files}
|
||||
|
||||
To create a new PDF/UA-1 file, with A4 portrait paper, one page, and the title \texttt{"My Book"}, we may write:
|
||||
|
||||
\begin{framed}
|
||||
\noindent\small\verb!cpdf -create-pdf-ua-1 "My Book" -o out.pdf!
|
||||
\end{framed}
|
||||
|
||||
\noindent A title is needed for every PDF/UA-1 document (even a blank one) for it to meet the standard. Note that any modifying \texttt{-create-pdf-pages} or \texttt{-create-pdf-papersize} must appear before \texttt{-create-pdf-ua-1} on the command line.
|
||||
|
||||
\clearpage\pagestyle{empty}
|
||||
%We wanted to call this "Chapter M", but the following commands messed up the PDF bookmarks, so this chapter will simply have to float for now, until we can return to this problem.
|
||||
%\setcounter{chapter}{12}
|
||||
|
|
10
cpdfua.ml
10
cpdfua.ml
|
@ -1584,3 +1584,13 @@ let print_struct_tree pdf =
|
|||
~get_name:(fun (E2 (x, a, _)) -> if int_of_string (get_page a) > 0 then x ^ " (" ^ get_page a ^ ")" else x)
|
||||
~get_children:(fun (E2 (_, _, cs)) -> cs)
|
||||
st)
|
||||
|
||||
let cpdfua_args title =
|
||||
[ "-create-pdf";
|
||||
"AND"; "-set-title"; title;
|
||||
"AND"; "-create-metadata";
|
||||
"AND"; "-set-language"; "en-US";
|
||||
"AND"; "-display-doc-title"; "true";
|
||||
"AND"; "-replace-obj"; "/Root/MarkInfo/Marked=true";
|
||||
"AND"; "-replace-obj"; "/Root/StructTreeRoot/Type={\"N\":\"/StructTreeRoot\"}";
|
||||
"AND"; "-mark-as"; "PDF/UA-1"]
|
||||
|
|
|
@ -23,3 +23,6 @@ val extract_struct_tree : Pdf.t -> Cpdfyojson.Safe.t
|
|||
|
||||
(** Reapply an edited JSON structure tree to its PDF. *)
|
||||
val replace_struct_tree : Pdf.t -> Cpdfyojson.Safe.t -> unit
|
||||
|
||||
(** / **)
|
||||
val cpdfua_args : string -> string list
|
||||
|
|
Loading…
Reference in New Issue