mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2025-06-05 22:09:39 +02:00
docs
This commit is contained in:
@ -429,7 +429,7 @@ let rec ops_of_drawop struct_tree dryrun pdf endpage filename bates batespad num
|
|||||||
[]
|
[]
|
||||||
| TextSection ops ->
|
| TextSection ops ->
|
||||||
let m = mcid () in
|
let m = mcid () in
|
||||||
if not dryrun then structdata := StDataMCID ("/P", m, None)::!structdata;
|
if not dryrun then structdata := StDataMCID ("P", m, None)::!structdata;
|
||||||
(if struct_tree && !do_auto_tag then [Pdfops.Op_BDC ("/P", Pdf.Dictionary ["/MCID", Pdf.Integer m])] else [])
|
(if struct_tree && !do_auto_tag then [Pdfops.Op_BDC ("/P", Pdf.Dictionary ["/MCID", Pdf.Integer m])] else [])
|
||||||
@ [Pdfops.Op_BT]
|
@ [Pdfops.Op_BT]
|
||||||
@ ops_of_drawops struct_tree dryrun pdf endpage filename bates batespad num page ops
|
@ ops_of_drawops struct_tree dryrun pdf endpage filename bates batespad num page ops
|
||||||
@ -460,7 +460,7 @@ let rec ops_of_drawop struct_tree dryrun pdf endpage filename bates batespad num
|
|||||||
| Tag s ->
|
| Tag s ->
|
||||||
let m = mcid () in
|
let m = mcid () in
|
||||||
if not dryrun then structdata := StDataMCID (s, m, None)::!structdata;
|
if not dryrun then structdata := StDataMCID (s, m, None)::!structdata;
|
||||||
[Pdfops.Op_BDC (s, Pdf.Dictionary ["/MCID", Pdf.Integer m])]
|
[Pdfops.Op_BDC ("/" ^ s, Pdf.Dictionary ["/MCID", Pdf.Integer m])]
|
||||||
| EndTag -> [Pdfops.Op_EMC]
|
| EndTag -> [Pdfops.Op_EMC]
|
||||||
| STag s -> if not dryrun then structdata =| StDataBeginTree s; []
|
| STag s -> if not dryrun then structdata =| StDataBeginTree s; []
|
||||||
| EndSTag -> if not dryrun then structdata =| StDataEndTree; []
|
| EndSTag -> if not dryrun then structdata =| StDataEndTree; []
|
||||||
@ -691,7 +691,7 @@ let write_structure_tree pdf st =
|
|||||||
(alt
|
(alt
|
||||||
@ page
|
@ page
|
||||||
@ namespace
|
@ namespace
|
||||||
@ [("/S", Pdf.Name kind);
|
@ [("/S", Pdf.Name ("/" ^ kind));
|
||||||
("/P", Pdf.Indirect struct_tree_parent);
|
("/P", Pdf.Indirect struct_tree_parent);
|
||||||
("/K", Pdf.Array (map (mktree this_objnum) children))])
|
("/K", Pdf.Array (map (mktree this_objnum) children))])
|
||||||
in
|
in
|
||||||
|
BIN
cpdfmanual.pdf
BIN
cpdfmanual.pdf
Binary file not shown.
@ -5210,7 +5210,38 @@ $cpdf -print-struct-tree out.pdf
|
|||||||
|
|
||||||
There are two types of tag we can add manually. One kind is used to tag individual pieces of content. We do this with a \texttt{-tag}/\texttt{-end-tag} pair. Note that nesting is not permitted here. For example, let us tag a heading:
|
There are two types of tag we can add manually. One kind is used to tag individual pieces of content. We do this with a \texttt{-tag}/\texttt{-end-tag} pair. Note that nesting is not permitted here. For example, let us tag a heading:
|
||||||
|
|
||||||
(H1 / Para example)
|
\begin{framed}
|
||||||
|
\noindent\small\verb!cpdf -create-pdf AND -draw-struct-tree -draw -mtrans "50 700" !\\
|
||||||
|
\noindent\small\verb! -font-size 40 -no-auto-tags -tag H1 -bt -text "This is the heading"!\\
|
||||||
|
\noindent\small\verb! -et -end-tag -auto-tags -mtrans "0 -100" -font-size 20 -leading 25!\\
|
||||||
|
\noindent\small\verb! -bt -paras "L200pt=This is the first paragraph, which spreads over!\\
|
||||||
|
\noindent\small\verb!more than one line\nHere is the second, which also has multiple lines..."!\\
|
||||||
|
\noindent\small\verb! -et AND -o out.pdf!
|
||||||
|
\noindent\small\verb!!
|
||||||
|
\noindent\small\verb!!
|
||||||
|
\noindent\small\verb!!
|
||||||
|
|
||||||
|
\end{framed}
|
||||||
|
|
||||||
|
\noindent Here is the result, visually:
|
||||||
|
|
||||||
|
\bigskip
|
||||||
|
\fbox{\includegraphics[width=0.3\textwidth]{manualimages/h1.pdf}}
|
||||||
|
\bigskip
|
||||||
|
|
||||||
|
\noindent And here is the structure tree:
|
||||||
|
|
||||||
|
\begin{verbatim}
|
||||||
|
/StructTreeRoot
|
||||||
|
└──
|
||||||
|
├── /H1 (1)
|
||||||
|
│ └──
|
||||||
|
├── /P (1)
|
||||||
|
│ └──
|
||||||
|
└── /P (1)
|
||||||
|
└──
|
||||||
|
\end{verbatim}
|
||||||
|
|
||||||
|
|
||||||
\noindent\verb!-stag! Begin structure tree branch\\
|
\noindent\verb!-stag! Begin structure tree branch\\
|
||||||
\noindent\verb!-end-stag! End structure tree branch\\
|
\noindent\verb!-end-stag! End structure tree branch\\
|
||||||
|
BIN
manualimages/h1.pdf
Normal file
BIN
manualimages/h1.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user