| Commit | Line | Data |
|---|---|---|
| 465b256c | 1 | .\" vim: ft=groff |
| 4d3e9548 JL |
2 | .ig |
| 3 | pdfmark.ms | |
| 4 | ||
| 5 | File position: <groff-source>/contrib/pdfmark/pdfmark.ms | |
| 6 | ||
| 7 | This file is part of groff, the GNU roff type-setting system. | |
| 8 | ||
| 9 | Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation, Inc. | |
| 10 | written by Keith Marshall <keith.d.marshall@ntlworld.com> | |
| 11 | ||
| 12 | Permission is granted to copy, distribute and/or modify this document | |
| 13 | under the terms of the GNU Free Documentation License, Version 1.3 or | |
| 14 | any later version published by the Free Software Foundation; with no | |
| 15 | Front-Cover Texts, no Back-Cover Texts, and the following Invariant | |
| 16 | Sections:-- | |
| 17 | ||
| 18 | a) This "Legal Matters" section, extending from the start of | |
| 19 | the document, to the end of the enclosing ".ig" section. | |
| 20 | ||
| 21 | b) The two lines below starting with `.AU' and `.AI'. | |
| 22 | ||
| 23 | A copy of the Free Documentation License is included as a file called | |
| 24 | FDL in the main directory of the groff source package. | |
| 25 | .. | |
| 26 | . | |
| 465b256c JR |
27 | .CS |
| 28 | Portable Document Format | |
| 29 | Publishing with GNU Troff | |
| 30 | .AU Keith Marshall | |
| 31 | .AI <keith.d.marshall@ntlworld.com> | |
| 32 | .CE | |
| 33 | .\" | |
| 34 | .\" Specify the Internet address for the groff web site. | |
| 35 | .\" Currently, there are two available addresses; a copy is maintained at ... | |
| 36 | .\" | |
| 37 | .ds GROFF-WEBSITE http://www.gnu.org/software/groff | |
| 38 | .\" | |
| 39 | .\" ... but the official home site is at ... | |
| 40 | .\" | |
| 41 | .ds GROFF-WEBSITE http://groff.ffii.org | |
| 42 | .\" | |
| 43 | .\" Set the PDF default document view attribute, to ensure that the document | |
| 44 | .\" outline is visible, each time the document is opened in Acrobat Reader. | |
| 45 | .\" | |
| 46 | .pdfview /PageMode /UseOutlines | |
| 47 | .\" | |
| 48 | .\" Initialise the outline view to show only three heading levels, | |
| 49 | .\" with additional subordinate level headings folded. | |
| 50 | .\" | |
| 51 | .nr PDFOUTLINE.FOLDLEVEL 3 | |
| 52 | .\" | |
| 53 | .\" Add document identification meta-data | |
| 54 | .\" | |
| 55 | .pdfinfo /Title Portable Document Format Publishing with GNU Troff | |
| 56 | .pdfinfo /Author Keith Marshall | |
| 57 | .pdfinfo /Subject Tips and Techniques for Exploiting PDF Features with GNU Troff | |
| 58 | .pdfinfo /Keywords groff troff PDF pdfmark | |
| 59 | .\" | |
| 60 | .\" Set the default cross reference format to indicate section numbers, | |
| 61 | .\" rather than page numbers, when we insert a reference pointer. | |
| 62 | .\" | |
| 63 | .ds PDFHREF.INFO section \\*[SN-NO-DOT] \\$* | |
| 64 | .\" | |
| 65 | .\" Define a macro, to print reference links WITHOUT the usual "see" prefix. | |
| 66 | .\" | |
| 67 | .de XR-NO-PREFIX | |
| 68 | .rn PDFHREF.PREFIX xx | |
| 69 | .ds PDFHREF.PREFIX | |
| 70 | .XR \\$@ | |
| 71 | .rn xx PDFHREF.PREFIX | |
| 72 | .. | |
| 73 | .\" | |
| 74 | .\" Define a string, | |
| 75 | .\" to insert a Registered Trade Mark symbol as a superscript. | |
| 76 | .\" | |
| 77 | .ds rg \*{\(rg\*} | |
| 78 | .\" | |
| 79 | .\" Establish the page layout. | |
| 80 | .\" | |
| 81 | .nr PO 2.5c | |
| 82 | .nr LL 17.0c | |
| 83 | .nr LT 17.0c | |
| 84 | .nr HY 0 | |
| 85 | .nr FF 3 | |
| 86 | .nr DI 5n | |
| 87 | .\" | |
| 88 | .\" Generate headers in larger point sizes, for NH levels < 4, | |
| 89 | .\" with point size increasing by 1.5p, for each lesser NH level. | |
| 90 | .\" | |
| 91 | .nr GROWPS 4 | |
| 92 | .nr PSINCR 1.5p | |
| 93 | .\" | |
| 94 | .de EM | |
| 95 | .\".I "\s'+0.3'\\$1\s0" "\\$2" "\\$3" | |
| 96 | .I \\$@ | |
| 97 | .. | |
| 98 | .de CWB | |
| 99 | \\$5\fC\\$3\fP\f(CB\\$1\fP\fC\\$2\fP\\$4 | |
| 100 | .. | |
| 101 | .de CWI | |
| 102 | \\$5\fC\\$3\fP\f(CI\\$1\fP\fC\\$2\fP\\$4 | |
| 103 | .. | |
| 104 | .de CWBI | |
| 105 | \\$5\fC\\$3\fP\f[CBI]\\$1\fP\fC\\$2\fP\\$4 | |
| 106 | .. | |
| 107 | .ds = \f(CB\\$1\f(CR\\$4\f[CBI]\\$2\f(CR\\$3 | |
| 108 | .\" | |
| 109 | .NH 1 | |
| 110 | .\" When we use numbered section headings, we might like to automatically | |
| 111 | .\" insert a table of contents entry, using the text of the heading itself. | |
| 112 | .\" The "ms" macros don't provide any standard mechanism for doing this, | |
| 113 | .\" but "spdf.tmac" adds the "XN" macro, which will do it for us. | |
| 114 | .\" | |
| 115 | .\" Here's a simple example of how we might use it. In this case, the word | |
| 116 | .\" "Introduction" will appear both in the body of the document, as the text | |
| 117 | .\" of the heading, and it will be added to the table of contents, which is | |
| 118 | .\" subsequently "printed" using the "TC" macro; in both locations, it will | |
| 119 | .\" be prefixed by the section number. | |
| 120 | .\" | |
| 121 | .\" As an additional side effect, any use of "XN" will cause the table of | |
| 122 | .\" contents entry to be automatically reproduced, with the exception of its | |
| 123 | .\" page number reference, as a PDF document outline entry. Thus, the use | |
| 124 | .\" of "XN" to specify numbered section headings results in the automatic | |
| 125 | .\" creation of a numbered PDF document outline. This automatic creation | |
| 126 | .\" of the outline is completely transparent, and will occur regardless | |
| 127 | .\" of whether the "TC" macro is subsequently invoked, or not. | |
| 128 | .\" | |
| 129 | .XN Introduction | |
| 130 | .\" | |
| 131 | .\" If using an old s.tmac, without the SN-NO-DOT extension, | |
| 132 | .\" make sure we get SOMETHING in section number references. | |
| 133 | .\" | |
| 134 | .if !dSN-NO-DOT .als SN-NO-DOT SN | |
| 135 | .LP | |
| 136 | It might appear that it is a fairly simple matter to | |
| 137 | produce documents in Adobe\*(rg\~\(lqPortable\~Document\~Format\(rq, | |
| 138 | commonly known as PDF, using | |
| 139 | .CW groff ) GNU\~Troff\~( | |
| 140 | as the document formatter. | |
| 141 | Indeed, | |
| 142 | .CW groff 's | |
| 143 | default output format is the native Adobe\*(rg\~PostScript\*(rg format, | |
| 144 | which PDF producers such as Adobe\*(rg Acrobat\*(rg Distiller\*(rg, | |
| 145 | or GhostScript, expect as their input format. | |
| 146 | Thus, the PDF production process would seem to entail simply | |
| 147 | formatting the document source with | |
| 148 | .CW groff , | |
| 149 | to produce a PostScript\*(rg version of the document, | |
| 150 | which can subsequently be processed by Acrobat\*(rg Distiller\*(rg | |
| 151 | or GhostScript, to generate the final PDF document. | |
| 152 | .LP | |
| 153 | For many PDF production requirements, | |
| 154 | the production cycle described above may be sufficient. | |
| 155 | However, this is a limited PDF production method, | |
| 156 | in which the resultant PDF document represents no more than | |
| 157 | an on screen image of the printed form of the document, if | |
| 158 | .CW groff 's | |
| 159 | PostScript\*(rg output were printed directly. | |
| 160 | .LP | |
| 161 | The Portable Document Format provides a number of features, | |
| 162 | which significantly enhance the experience of reading a document on screen, | |
| 163 | but which are of little or no value to a document which is merely printed. | |
| 164 | It | |
| 165 | .EM is | |
| 166 | possible to exploit these PDF features, which are described in the Adobe\*(rg | |
| 167 | .\" | |
| 168 | .de pdfmark-manual | |
| 169 | .\" This is an example of a resource reference specified by URI ... | |
| 170 | .\" We may need to refer often to the Adobe pdfmark Reference Manual, | |
| 171 | .\" so we create the internet link definition using a macro, to make | |
| 172 | .\" it reusable. | |
| 173 | .\" | |
| 174 | .\" Note also, that we protect the description of the reference by | |
| 175 | .\" preceding it with "--", to avoid "invalid character in name" type | |
| 176 | .\" error messages from groff (caused by the use of "\~"). | |
| 177 | .\" | |
| 4d3e9548 | 178 | .pdfhref W -D http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/pdf_creation_apis_and_specs/pdfmarkReference.pdf \ |
| 465b256c JR |
179 | -P \(lq -A \(rq\\$1 -- pdfmark\~Reference\~Manual |
| 180 | .. | |
| 181 | .pdfmark-manual , | |
| 182 | with some refinement of the simple PDF production method, provided | |
| 183 | appropriate \(lqfeature implementing\(rq instructions can be embedded into | |
| 184 | .CW groff 's | |
| 185 | PostScript\*(rg rendering of the document. | |
| 186 | This, of course, implies that the original document source, which | |
| 187 | .CW groff | |
| 188 | will process to generate the PostScript\*(rg description of the document, | |
| 189 | must include appropriate markup to exploit the desired PDF features. | |
| 190 | It is this preparation of the | |
| 191 | .CW groff | |
| 192 | document source to exploit a number of these features, | |
| 193 | which provides the principal focus of this document. | |
| 194 | .LP | |
| 195 | The markup techniques to be described have been utilised in the production of | |
| 196 | the PDF version of this document itself. | |
| 197 | This has been formatted using | |
| 198 | .CW groff 's | |
| 199 | .CW ms | |
| 200 | macro package; | |
| 201 | thus, usage examples may be found in the document source file, | |
| 202 | .CW \n(.F , | |
| 203 | to which comments have been added, | |
| 204 | to help identify appropriate markup examples for implementing PDF features, | |
| 205 | such as:\(en | |
| 206 | .QS | |
| 207 | .IP \(bu | |
| 208 | Selecting a default document view, which defines how the document will appear | |
| 209 | when opened in the reader application; for example, when this document is | |
| 210 | opened in Acrobat\*(rg\~Reader, it should display the top of the cover sheet, | |
| 211 | in the document view pane, while a document outline should appear to the left, | |
| 212 | in the \(lqBookmarks\(rq pane. | |
| 213 | .IP \(bu | |
| 214 | Adding document identification \(lqmeta\(hydata\(rq, | |
| 215 | which can be accessed, in Acrobat\*(rg\~Reader, | |
| 216 | by inspecting the \(lqFile\^/\^Document\~Properties\^/\^Summary\(rq. | |
| 217 | .IP \(bu | |
| 218 | Creating a document outline, which will be displayed in the \(lqBookmarks\(rq | |
| 219 | pane of Acrobat\*(rg\~Reader, such that readers may quickly navigate to any | |
| 220 | section of the document, simply by clicking on the associated heading | |
| 221 | in the outline view. | |
| 222 | .IP \(bu | |
| 223 | Embedding active links in the body of the document, such that readers may | |
| 224 | quickly navigate to related material at another location within the same | |
| 225 | document, or in another PDF document, or even to a related Internet resource, | |
| 226 | specified by its URI. | |
| 227 | .IP \(bu | |
| 228 | Adding annotations, in the form of \(lqsticky notes\(rq, at strategic | |
| 229 | points within the PDF document. | |
| 230 | .QE | |
| 231 | .LP | |
| 232 | All of the techniques described have been tested on | |
| 233 | .EM both | |
| 234 | GNU/Linux, and on Microsoft\*(rg Windows\(tm2000 operating platforms, using | |
| 235 | .CW groff | |
| 236 | .CW 1.19.1 ,\c | |
| 237 | .pdfhref L -D footnote1 -- \** | |
| 238 | .FS | |
| 239 | .pdfhref M footnote1 | |
| 240 | Later versions should, and some earlier versions may, be equally suitable. | |
| 241 | See | |
| 242 | .pdfhref W \*[GROFF-WEBSITE] | |
| 243 | for information and availability of the latest version. | |
| 244 | .FE | |
| 245 | in association with | |
| 246 | .CW AFPL | |
| 247 | .CW GhostScript | |
| 248 | .CW 8.14 .\c | |
| 249 | .pdfhref L -D footnote2 -- \** | |
| 250 | .FS | |
| 251 | .pdfhref M footnote2 | |
| 252 | Again, other versions may be suitable. | |
| 253 | See | |
| 254 | .pdfhref W http://ghostscript.com | |
| 255 | for information and availability. | |
| 256 | .FE | |
| 257 | Other tools employed, which should be readily available on | |
| 258 | .EM any | |
| 259 | .SM | |
| 260 | UNIX\(tm | |
| 261 | .LG | |
| 262 | or GNU/Linux system, are | |
| 263 | .CW sed , | |
| 264 | .CW awk | |
| 265 | and | |
| 266 | .CW make , | |
| 267 | together with an appropriate text editor, for creating and marking up the | |
| 268 | .CW groff | |
| 269 | input files. | |
| 270 | These additional utilities are not provided, as standard, | |
| 271 | on the Microsoft\*(rg Windows\(tm platform, | |
| 272 | but several third party implementations are available. | |
| 273 | Some worth considering include the MKS\*(rg\~Toolkit,\** | |
| 274 | .FS | |
| 275 | A commercial offering; see | |
| 276 | .pdfhref W http://mkssoftware.com/products/tk/default.asp | |
| 277 | for information. | |
| 278 | .FE | |
| 279 | Cygwin,\** | |
| 280 | .FS | |
| 281 | A | |
| 282 | .EM free | |
| 283 | but comprehensive | |
| 284 | .SM | |
| 285 | POSIX | |
| 286 | .LG | |
| 287 | emulation environment and | |
| 288 | .SM | |
| 289 | UNIX\(tm | |
| 290 | .LG | |
| 291 | toolkit for 32\(hybit Microsoft\*(rg Windows\(tm platforms; see | |
| 292 | .pdfhref W http://cygwin.com | |
| 293 | for information and download. | |
| 294 | .FE | |
| 295 | or MSYS.\** | |
| 296 | .FS | |
| 297 | Another free, but minimal suite of common | |
| 298 | .SM | |
| 299 | UNIX\(tm | |
| 300 | .LG | |
| 301 | tools for 32\(hybit Microsoft\*(rg Windows\(tm, available for download from | |
| 302 | .pdfhref W -A ; http://www.mingw.org | |
| 303 | it | |
| 304 | .EM does | |
| 305 | include those tools listed above, | |
| 306 | and is the package which was actually used when performing the Windows\(tm2000 | |
| 307 | platform tests referred to in the text. | |
| 308 | .FE | |
| 309 | This list is by no means exhaustive, and should in no way be construed as an | |
| 310 | endorsement of any of these packages, nor to imply that other similar packages, | |
| 311 | which may be available, are in any way inferior to them. | |
| 312 | .bp | |
| 313 | .NH 1 | |
| 314 | .\" We may wish a section heading to represent a named destination, | |
| 315 | .\" so that we can create a linked reference to it, from some other | |
| 316 | .\" part of the PDF document, (or even from another PDF document). | |
| 317 | .\" | |
| 318 | .\" Here we use the "-N" option of the "XN" macro, to create a named | |
| 319 | .\" PDF link destination, at the location of the heading. Notice that | |
| 320 | .\" we also use the "--" marker to separate the heading text from the | |
| 321 | .\" preceding option specification; it is not strictly necessary in | |
| 322 | .\" this case, but it does help to set off the heading text from the | |
| 323 | .\" option specification. | |
| 324 | .\" | |
| 325 | .XN -N pdf-features -- Exploiting PDF Document Features | |
| 326 | .LP | |
| 327 | To establish a consistent framework for adding PDF features, a | |
| 328 | .CW groff | |
| 329 | macro package, named | |
| 330 | .CW pdfmark.tmac , | |
| 331 | has been provided. | |
| 332 | Thus, to incorporate PDF features in a document, | |
| 333 | the appropriate macro calls, as described below, may be placed in the | |
| 334 | .CW groff | |
| 335 | document source, which should then be processed with a | |
| 336 | .CW groff | |
| 337 | command of the form | |
| 338 | .QP | |
| 339 | .fam C | |
| 340 | groff -Tps [-m | |
| 341 | .I name "] -m" | |
| 342 | .B pdfmark | |
| 343 | .I options \& [- | |
| 344 | .I "file ..." \& "...] " | |
| 345 | .LP | |
| 346 | It may be noted that the | |
| 347 | .CW pdfmark | |
| 348 | macros have no dependencies on, and no known conflicts with, | |
| 349 | any other | |
| 350 | .CW groff | |
| 351 | macro package; thus, users are free to use any other macro package, | |
| 352 | of their choice, to format their documents, while also using the | |
| 353 | .CW pdfmark | |
| 354 | macros to add PDF features. | |
| 355 | .NH 2 | |
| 356 | .XN -N pdfmark-operator -- The \F[C]pdfmark\F[] Operator | |
| 357 | .LP | |
| 358 | All PDF features are implemented by embedding instances of the | |
| 359 | .B \F[C]pdfmark\F[] | |
| 360 | operator, as described in the Adobe\*(rg | |
| 361 | .pdfmark-manual , | |
| 362 | into | |
| 363 | .CW groff 's | |
| 364 | PostScript\*(rg output stream. | |
| 365 | To facilitate the use of this operator, the | |
| 366 | .CW pdfmark | |
| 367 | macro package defines the primitive | |
| 368 | .CW pdfmark | |
| 369 | macro; it simply emits its argument list, | |
| 370 | as arguments to a | |
| 371 | .CW pdfmark | |
| 372 | operator, in the PostScript\*(rg output stream. | |
| 373 | .LP | |
| 374 | .pdfhref M -N pdfmark-example | |
| 375 | To illustrate the use of the | |
| 376 | .CW pdfmark | |
| 377 | macro, the following is a much simplified example of how a bookmark | |
| 378 | may be added to a PDF document outline | |
| 379 | .QP | |
| 380 | .CW ".pdfmark \e" | |
| 381 | .RS 4 | |
| 382 | .nf | |
| 383 | .fam C | |
| 384 | /Count 2 \e | |
| 385 | /Title (An Example of a Bookmark with Two Children) \e | |
| 386 | /View [/FitH \en[PDFPAGE.Y]] \e | |
| 387 | /OUT | |
| 388 | .RE | |
| 389 | .LP | |
| 390 | In general, users should rarely need to use the | |
| 391 | .CW pdfmark | |
| 392 | macro directly. | |
| 393 | In particular, the above example is too simple for general use; it | |
| 394 | .EM will | |
| 395 | create a bookmark, but it does | |
| 396 | .EM not | |
| 397 | address the issues of setting the proper value for the | |
| 398 | .CW /Count | |
| 399 | key, nor of computing the | |
| 400 | .CW PDFPAGE.Y | |
| 401 | value used in the | |
| 402 | .CW /View | |
| 403 | key. The | |
| 404 | .CW pdfmark | |
| 405 | macro package includes a more robust mechanism for creating bookmarks, | |
| 406 | .\" | |
| 407 | .\" Here is an example of how a local reference may be planted, | |
| 408 | .\" using the automatic formatting feature of the "pdfhref" macro. | |
| 409 | .\" | |
| 410 | .\" This is a forward reference to the named destination "add-outline", | |
| 411 | .\" which is defined below, using the "XN" wrapper macro, from the | |
| 412 | .\" "spdf.tmac" macro package. The automatically formatted reference | |
| 413 | .\" will be enclosed in parentheses, as specified by the use of | |
| 414 | .\" "-P" and "-A" options. | |
| 415 | .\" | |
| 416 | .pdfhref L -P ( -A ), -D add-outline | |
| 417 | .\" | |
| 418 | which addresses these issues automatically. | |
| 419 | Nevertheless, the | |
| 420 | .CW pdfmark | |
| 421 | macro may be useful to users wishing to implement more advanced PDF features, | |
| 422 | than those currently supported directly by the | |
| 423 | .CW pdfmark | |
| 424 | macro package. | |
| 425 | .NH 2 | |
| 426 | .XN -N docview -- Selecting an Initial Document View | |
| 427 | .LP | |
| 428 | By default, | |
| 429 | when a PDF document is opened, | |
| 430 | the first page will be displayed, | |
| 431 | at the default magnification set for the reader, | |
| 432 | and outline and thumbnail views will be hidden. | |
| 433 | When using a PDF reader, | |
| 434 | such as Acrobat\*(rg\~Reader, | |
| 435 | which supports the | |
| 436 | .CW /DOCVIEW | |
| 437 | class of the | |
| 438 | .CW pdfmark | |
| 439 | operator, | |
| 440 | these default initial view settings may be overridden, | |
| 441 | using the | |
| 442 | .CW pdfview | |
| 443 | macro. | |
| 444 | For example | |
| 445 | .QP | |
| 446 | .CW ".pdfview /PageMode /UseOutlines" | |
| 447 | .LP | |
| 448 | will cause Acrobat\*(rg\~Reader to open the document outline view, | |
| 449 | to the left of the normal page view, | |
| 450 | while | |
| 451 | .QP | |
| 452 | .CW ".pdfview /PageMode /UseThumbs" | |
| 453 | .LP | |
| 454 | will open the thumbnail view instead. | |
| 455 | .LP | |
| 456 | Note that the two | |
| 457 | .CW /PageMode | |
| 458 | examples, above, are mutually exclusive \(em it is not possible to have | |
| 459 | .EM both | |
| 460 | outline and thumbnail views open simultaneously. | |
| 461 | However, it | |
| 462 | .EM is | |
| 463 | permitted to add | |
| 464 | .CW /Page | |
| 465 | and | |
| 466 | .CW /View | |
| 467 | keys, to force the document to open at a page other than the first, | |
| 468 | or to change the magnification at which the document is initially displayed; | |
| 469 | see the | |
| 470 | .pdfmark-manual | |
| 471 | for more information. | |
| 472 | .LP | |
| 473 | It should be noted that the view controlling meta\(hydata, defined by the | |
| 474 | .CW pdfview | |
| 475 | macro, is not written immediately to the PostScript\*(rg output stream, | |
| 476 | but is stored in an internal meta\(hydata \(lqcache\(rq, | |
| 477 | (simply implemented as a | |
| 478 | .CW groff | |
| 479 | diversion). | |
| 480 | This \(lqcached\(lq meta\(hydata must be written out later, by invoking the | |
| 481 | .CW pdfsync | |
| 482 | macro, | |
| 483 | .\" | |
| 484 | .\" Here is another example of how we may introduce a forward reference. | |
| 485 | .\" This time we are using the shorter notation afforded by the "XR" macro | |
| 486 | .\" provided by "spdf.tmac"; this example is equivalent to the native | |
| 487 | .\" "pdfmark.tmac" form | |
| 488 | .\" .pdfhref L -D pdfsync -P ( -A ). | |
| 489 | .\" | |
| 490 | .XR pdfsync ). ( | |
| 491 | .\" | |
| 492 | .NH 2 | |
| 493 | .XN -N docinfo -- Adding Document Identification Meta-Data | |
| 494 | .LP | |
| 495 | In addition to the | |
| 496 | .CW /DOCVIEW | |
| 497 | class of meta\(hydata described above, | |
| 498 | .XR docview ), ( | |
| 499 | we may also wish to include document identification meta\(hydata, | |
| 500 | which belongs to the PDF | |
| 501 | .CW /DOCINFO | |
| 502 | class. | |
| 503 | .LP | |
| 504 | To do this, we use the | |
| 505 | .CW pdfinfo | |
| 506 | macro. | |
| 507 | As an example of how it is used, | |
| 508 | the identification meta\(hydata attached to this document | |
| 509 | was specified using a macro sequence similar to:\(en | |
| 510 | .DS I | |
| 511 | .CW | |
| 512 | \&.pdfinfo /Title PDF Document Publishing with GNU Troff | |
| 513 | \&.pdfinfo /Author Keith Marshall | |
| 514 | \&.pdfinfo /Subject How to Exploit PDF Features with GNU Troff | |
| 515 | \&.pdfinfo /Keywords groff troff PDF pdfmark | |
| 516 | .DE | |
| 517 | Notice that the | |
| 518 | .CW pdfinfo | |
| 519 | macro is repeated, once for each | |
| 520 | .CW /DOCINFO | |
| 521 | record to be placed in the document. | |
| 522 | In each case, the first argument is the name of the applicable | |
| 523 | .CW /DOCINFO | |
| 524 | key, which | |
| 525 | .EM must | |
| 526 | be named with an initial solidus character; | |
| 527 | all additional arguments are collected together, | |
| 528 | to define the value to be associated with the specified key. | |
| 529 | .LP | |
| 530 | As is the case with the | |
| 531 | .CW pdfview | |
| 532 | macro, | |
| 533 | .XR docview ), ( | |
| 534 | the | |
| 535 | .CW /DOCINFO | |
| 536 | records specified with the | |
| 537 | .CW pdfinfo | |
| 538 | macro are not immediately written to the PostScript\*(rg output stream; | |
| 539 | they are stored in the same meta\(hydata cache as | |
| 540 | .CW /DOCVIEW | |
| 541 | specifications, until this cache is explicitly flushed, | |
| 542 | by invoking the | |
| 543 | .CW pdfsync | |
| 544 | macro, | |
| 545 | .XR pdfsync ). ( | |
| 546 | .NH 2 | |
| 547 | .XN -N add-outline -- Creating a Document Outline | |
| 548 | .LP | |
| 549 | A PDF document outline comprises a table of references, | |
| 550 | to \(lqbookmarked\(rq locations within the document. | |
| 551 | When the document is viewed in an \(lqoutline\~aware\(rq PDF document reader, | |
| 552 | such as Adobe\*(rg Acrobat\*(rg Reader, | |
| 553 | this table of \(lqbookmarks\(rq may be displayed in a document outline pane, | |
| 554 | or \(lqBookmarks\(rq pane, to the left of the main document view. | |
| 555 | Individual references in the outline view may then be selected, | |
| 556 | by clicking with the mouse, | |
| 557 | to jump directly to the associated marked location in the document view. | |
| 558 | .LP | |
| 559 | The document outline may be considered as a collection of \(lqhypertext\(rq | |
| 560 | references to \(lqbookmarked\(rq locations within the document. | |
| 561 | The | |
| 562 | .CW pdfmark | |
| 563 | macro package provides a single generalised macro, | |
| 564 | .CW pdfhref , | |
| 565 | for creating and linking to \(lqhypertext\(rq reference marks. | |
| 566 | This macro will be described more comprehensively in a later section, | |
| 567 | .XR pdfhref ); ( | |
| 568 | the description here is restricted to its use for defining document outline entries. | |
| 569 | .NH 3 | |
| 570 | .XN -N basic-outline -- A Basic Document Outline | |
| 571 | .LP | |
| 572 | In its most basic form, the document outline comprises a structured list of headings, | |
| 573 | each associated with a marked location, or \(lqbookmark\(rq, in the document text, | |
| 574 | and a specification for how that marked location should be displayed, | |
| 575 | when this bookmark is selected. | |
| 576 | .LP | |
| 577 | To create a PDF bookmark, the | |
| 578 | .CW pdfhref | |
| 579 | macro is used, | |
| 580 | at the point in the document where the bookmark is to be placed, | |
| 581 | in the form | |
| 582 | .QP | |
| 583 | .fam C | |
| 584 | .B ".pdfhref O" | |
| 585 | .I level > < | |
| 586 | .I "descriptive text ..." | |
| 587 | .LP | |
| 588 | in which the reference class | |
| 589 | .CWB O \& \& \(rq \(lq | |
| 590 | stipulates that this is an outline reference. | |
| 591 | .LP | |
| 592 | Alternatively, for those users who may prefer to think of a document outline | |
| 593 | simply as a collection of bookmarks, the | |
| 594 | .CW pdfbookmark | |
| 595 | macro is also provided \(em indeed, | |
| 596 | .CW pdfhref | |
| 597 | invokes it, when processing the | |
| 598 | .CWB O \& \& \(rq \(lq | |
| 599 | reference class operator. | |
| 600 | It may be invoked directly, in the form | |
| 601 | .QP | |
| 602 | .fam C | |
| 603 | .B .pdfbookmark | |
| 604 | .I level > < | |
| 605 | .I "descriptive text ..." | |
| 606 | .LP | |
| 607 | Irrespective of which of the above macro forms is employed, the | |
| 608 | .CWI level > < | |
| 609 | argument is required. | |
| 610 | It is a numeric argument, defining the nesting level of the \(lqbookmark\(rq | |
| 611 | in the outline hierarchy, with one being the topmost level. | |
| 612 | Its function may be considered analagous to the | |
| 613 | .EM "heading level" | |
| 614 | of the document's section headings, | |
| 615 | for example, as specified with the | |
| 616 | .CW NH | |
| 617 | macro, if using the | |
| 618 | .CW ms | |
| 619 | macros to format the document. | |
| 620 | .LP | |
| 621 | All further arguments, following the | |
| 622 | .CWI level > < | |
| 623 | argument, are collected together, to specify the heading text which will appear | |
| 624 | in the document's outline view. | |
| 625 | Thus, the outline entry for this section of this document, | |
| 626 | which has a level three heading, | |
| 627 | might be specified as | |
| 628 | .QP | |
| 629 | .CW | |
| 630 | \&.pdfhref O 3 \*(SN A Basic Document Outline | |
| 631 | .LP | |
| 632 | or, in the alternative form using the | |
| 633 | .CW pdfbookmark | |
| 634 | macro, as | |
| 635 | .QP | |
| 636 | .CW | |
| 637 | \&.pdfbookmark 3 \*(SN A Basic Document Outline | |
| 638 | .NH 3 | |
| 639 | .XN Hierarchical Structure in a Document Outline | |
| 640 | .LP | |
| 641 | When a document outline is created, using the | |
| 642 | .CW pdfhref | |
| 643 | macro as described in | |
| 644 | .\" | |
| 645 | .\" Here is an example of how we can temporarily modify the format of | |
| 646 | .\" a reference link, in this case to indicate only the section number | |
| 647 | .\" of the link target, in the form "section #", (or, if we define | |
| 648 | .\" "SECREF.BEGIN" before the call, its content followed by the | |
| 649 | .\" section number). | |
| 650 | .\" | |
| 651 | .\" We first define a macro, which will get the reference data from | |
| 652 | .\" pdfhref, as arguments, and will return the formatted output, as we | |
| 653 | .\" require it, the string "PDFHREF.TEXT". | |
| 654 | .\" | |
| 655 | .de SECREF | |
| 656 | .while \\n(.$ \{\ | |
| 657 | . ie '\\$1'section' \{\ | |
| 658 | . if !dSECREF.BEGIN .ds SECREF.BEGIN \\$1 | |
| 659 | . ds PDFHREF.TEXT \\*[SECREF.BEGIN]\~\\$2 | |
| 660 | . rm SECREF.BEGIN | |
| 661 | . shift \\n(.$ | |
| 662 | . \} | |
| 663 | . el .shift | |
| 664 | . \} | |
| 665 | .. | |
| 666 | .\" We now tell "pdfhref" to use our formatting macro, in place of | |
| 667 | .\" its builtin default formatter, before we specify the reference. | |
| 668 | .\" | |
| 669 | .pdfhref F SECREF | |
| 670 | .pdfhref L -A , -D basic-outline | |
| 671 | .\" | |
| 672 | .\" At this point, we would normally revert the "pdfhref" formatter | |
| 673 | .\" to use its default, built in macro. However, in this particular | |
| 674 | .\" case, we want to use our custom format one more time, before we | |
| 675 | .\" revert it, so we will omit the reversion step this time. | |
| 676 | .\" | |
| 677 | and any entry is added at a nesting level greater than one, | |
| 678 | then a hierarchical structure is automatically defined for the outline. | |
| 679 | However, as was noted in the simplified | |
| 680 | .pdfhref L -D pdfmark-example -- example | |
| 681 | in | |
| 682 | .pdfhref L -A , -D pdfmark-operator | |
| 683 | .\" | |
| 684 | .\" And now, we revert to default "pdfhref" formatting behaviour, | |
| 685 | .\" by completing the call we delayed above. | |
| 686 | .\" | |
| 687 | .pdfhref F | |
| 688 | .\" | |
| 689 | the data required by the | |
| 690 | .CW pdfmark | |
| 691 | operator to create the outline entry may not be fully defined, | |
| 692 | when the outline reference is defined in the | |
| 693 | .CW groff | |
| 694 | document source. | |
| 695 | Specifically, when the outline entry is created, its | |
| 696 | .CW /Count | |
| 697 | key must be assigned a value equal to the number of its subordinate entries, | |
| 698 | at the next inner level of the outline hierarchy; | |
| 699 | typically however, | |
| 700 | these subordinate entries will be defined | |
| 701 | .EM later | |
| 702 | in the document source, and the appropriate | |
| 703 | .CW /Count | |
| 704 | value will be unknown, when defining the parent entry. | |
| 705 | .LP | |
| 706 | To resolve this paradox, the | |
| 707 | .CW pdfhref | |
| 708 | macro creates the outline entry in two distinct phases \(em | |
| 709 | a destination marker is placed in the PostScript\*(rg output stream immediately, | |
| 710 | when the outline reference is defined, | |
| 711 | but the actual outline entry is stored in an internal \(lqoutline cache\(rq, | |
| 712 | until its subordinate hierarchy has been fully defined; | |
| 713 | it can then be inserted in the output stream, with its | |
| 714 | .CW /Count | |
| 715 | value correctly assigned. | |
| 716 | Effectively, to ensure integrity of the document outline structure, | |
| 717 | this means that each top level outline entry, and | |
| 718 | .EM all | |
| 719 | of its subordinates, are retained in the cache, until the | |
| 720 | .EM next | |
| 721 | top level entry is defined. | |
| 722 | .LP | |
| 723 | One potential problem, which arises from the use of the \(lqoutline cache\(rq, | |
| 724 | is that, at the end of any document formatting run, the last top level outline entry, | |
| 725 | and any subordinates defined after it, will remain in the cache, and will | |
| 726 | .EM not | |
| 727 | be automatically written to the output stream. | |
| 728 | To avoid this problem, the user should follow the guidelines given in | |
| 729 | .\" | |
| 730 | .\" Here is a more conventional example of how to temporarily change | |
| 731 | .\" to the format used to display reference links. We will again use | |
| 732 | .\" the "SECREF" format, which we defined above, but on this occasion | |
| 733 | .\" we will immediately revert to the default format, after the link | |
| 734 | .\" has been placed. | |
| 735 | .\" | |
| 736 | .pdfhref F SECREF | |
| 737 | .pdfhref L -D pdfsync -A , | |
| 738 | .pdfhref F | |
| 739 | .\" | |
| 740 | to synchronise the output state with the cache state, | |
| 741 | .XR pdfsync ), ( | |
| 742 | at the end of the | |
| 743 | .CW groff | |
| 744 | formatting run. | |
| 745 | .NH 3 | |
| 746 | .XN -N outline-view -- Associating a Document View with an Outline Reference | |
| 747 | .LP | |
| 748 | Each \(lqbookmark\(rq entry, in a PDF document outline, | |
| 749 | is associated with a specific document view. | |
| 750 | When the reader selects any outline entry, | |
| 751 | the document view changes to display the document context | |
| 752 | associated with that entry. | |
| 753 | .LP | |
| 754 | The document view specification, | |
| 755 | to be associated with any document outline entry, | |
| 756 | is established at the time when the outline entry is created. | |
| 757 | However, rather than requiring that each individual use of the | |
| 758 | .CW pdhref | |
| 759 | macro, to create an outline entry, | |
| 760 | should include its own view specification, | |
| 761 | the actual specification assigned to each entry is derived from | |
| 762 | a generalised specification defined in the string | |
| 763 | .CW PDFBOOKMARK.VIEW , | |
| 764 | together with the setting of the numeric register | |
| 765 | .CW PDFHREF.VIEW.LEADING , | |
| 766 | which determine the effective view specification as follows:\(en | |
| 767 | .QS | |
| 768 | .IP \*[= PDFBOOKMARK.VIEW] | |
| 769 | Establishes the magnification at which the document will be viewed, | |
| 770 | at the location of the \(lqbookmark\(rq; by default, it is defined by | |
| 771 | .RS | |
| 772 | .QP | |
| 773 | .CW ".ds PDFBOOKMARK.VIEW /FitH \e\en[PDFPAGE.Y] u" | |
| 774 | .RE | |
| 775 | .IP | |
| 776 | which displays the associated document view, | |
| 777 | with the \(lqbookmark\(rq location positioned at the top of the display window, | |
| 778 | and with the magnification set to fit the page width to the width of the window. | |
| 779 | .IP \*[= PDFHREF.VIEW.LEADING] | |
| 780 | Specifies additional spacing, | |
| 781 | to be placed between the top of the display window | |
| 782 | and the actual location of the \(lqbookmark\(rq on the displayed page view. | |
| 783 | By default, it is set as | |
| 784 | .RS | |
| 785 | .QP | |
| 786 | .CW ".nr PDFHREF.VIEW.LEADING 5.0p" | |
| 787 | .RE | |
| 788 | .IP | |
| 789 | Note that | |
| 790 | .CW PDFHREF.VIEW.LEADING | |
| 791 | does not represent true \(lqleading\(rq, in the typographical sense, | |
| 792 | since any preceding text, set in the specified display space, | |
| 793 | will be visible at the top of the document viewing window, | |
| 794 | when the reference is selected. | |
| 795 | .IP | |
| 796 | Also note that the specification of | |
| 797 | .CW PDFHREF.VIEW.LEADING | |
| 798 | is shared by | |
| 799 | .EM all | |
| 800 | reference views defined by the | |
| 801 | .CW pdfhref | |
| 802 | macro; whereas | |
| 803 | .CW PDFBOOKMARK.VIEW | |
| 804 | is applied exclusively to outline references, | |
| 805 | there is no independent | |
| 806 | .CW PDFBOOKMARK.VIEW.LEADING | |
| 807 | specification. | |
| 808 | .QE | |
| 809 | .LP | |
| 810 | If desired, the view specification may be changed, by redefining the string | |
| 811 | .CW PDFBOOKMARK.VIEW , | |
| 812 | and possibly also the numeric register | |
| 813 | .CW PDFHREF.VIEW.LEADING . | |
| 814 | Any alternative definition for | |
| 815 | .CW PDFBOOKMARK.VIEW | |
| 816 | .EM must | |
| 817 | be specified in terms of valid view specification parameters, | |
| 818 | as described in the Adobe\*(rg | |
| 819 | .pdfmark-manual . | |
| 820 | .LP | |
| 821 | Note the use of the register | |
| 822 | .CW PDFPAGE.Y , | |
| 823 | in the default definition of | |
| 824 | .CW PDFBOOKMARK.VIEW | |
| 825 | above. | |
| 826 | This register is computed by | |
| 827 | .CW pdfhref , | |
| 828 | when creating an outline entry; | |
| 829 | it specifies the vertical position of the \(lqbookmark\(rq, | |
| 830 | in basic | |
| 831 | .CW groff | |
| 832 | units, relative to the | |
| 833 | .EM bottom | |
| 834 | edge of the document page on which it is defined, | |
| 835 | and is followed, in the | |
| 836 | .CW PDFBOOKMARK.VIEW | |
| 837 | definition, by the | |
| 838 | .CW grops | |
| 839 | .CW u \(rq \(lq | |
| 840 | operator, to convert it to PostScript\*(rg units on output. | |
| 841 | It may be used in any redefined specification for | |
| 842 | .CW PDFBOOKMARK.VIEW , | |
| 843 | (or in the analogous definition of | |
| 844 | .CW PDFHREF.VIEW , | |
| 845 | described in | |
| 846 | .XR-NO-PREFIX pdfhref-view ), | |
| 847 | but | |
| 848 | .EM not | |
| 849 | in any other context, | |
| 850 | since its value is undefined outside the scope of the | |
| 851 | .CW pdfhref | |
| 852 | macro. | |
| 853 | .LP | |
| 854 | Since | |
| 855 | .CW PDFPAGE.Y | |
| 856 | is computed relative to the | |
| 857 | .EM bottom | |
| 858 | of the PDF output page, | |
| 859 | it is important to ensure that the page length specified to | |
| 860 | .CW troff | |
| 861 | correctly matches the size of the logical PDF page. | |
| 862 | This is most effectively ensured, | |
| 863 | by providing | |
| 864 | .EM identical | |
| 865 | page size specifications to | |
| 866 | .CW groff , | |
| 867 | .CW grops | |
| 868 | and to the PostScript\*(rg to PDF converter employed, | |
| 869 | and avoiding any page length changes within the document source. | |
| 870 | .LP | |
| 871 | Also note that | |
| 872 | .CW PDFPAGE.Y | |
| 873 | is the only automatically computed \(lqbookmark\(rq location parameter; | |
| 874 | if the user redefines | |
| 875 | .CW PDFBOOKMARK.VIEW , | |
| 876 | and the modified view specification requires any other positional parameters, | |
| 877 | then the user | |
| 878 | .EM must | |
| 879 | ensure that these are computed | |
| 880 | .EM before | |
| 881 | invoking the | |
| 882 | .CW pdfhref | |
| 883 | macro. | |
| 884 | .NH 3 | |
| 885 | .XN -N outline-folding -- Folding the Outline to Conceal Less Significant Headings | |
| 886 | .LP | |
| 887 | When a document incorporates many subheadings, | |
| 888 | at deeply nested levels, | |
| 889 | it may be desirable to \(lqfold\(rq the outline | |
| 890 | such that only the major heading levels are initially visible, | |
| 891 | yet making the inferior subheadings accessible, | |
| 892 | by allowing the reader to expand the view of any heading branch on demand. | |
| 893 | .LP | |
| 894 | The | |
| 895 | .CW pdfmark | |
| 896 | macros support this capability, | |
| 897 | through the setting of the | |
| 898 | .CW PDFOUTLINE.FOLDLEVEL | |
| 899 | register. | |
| 900 | This register should be set to the number of heading levels | |
| 901 | which it is desired to show in expanded form, in the | |
| 902 | .EM initial | |
| 903 | document outline display; | |
| 904 | all subheadings at deeper levels will still be added to the outline, | |
| 905 | but will not become visible until the outline branch containing them is expanded. | |
| 906 | 'ne 5 | |
| 907 | For example, the setting used in this document: | |
| 908 | .QS | |
| 909 | .LD | |
| 910 | .fam C | |
| 911 | \&.\e" Initialise the outline view to show only three heading levels, | |
| 912 | \&.\e" with additional subordinate level headings folded. | |
| 913 | \&.\e" | |
| 914 | \&.nr PDFOUTLINE.FOLDLEVEL 3 | |
| 915 | .DE | |
| 916 | .QE | |
| 917 | .LP | |
| 918 | results in only the first three levels of headings being displayed | |
| 919 | in the document outline, | |
| 920 | .EM until | |
| 921 | the reader chooses to expand the view, | |
| 922 | and so reveal the lower level headings in any outline branch. | |
| 923 | .LP | |
| 924 | The initial default setting of | |
| 925 | .CW PDFOUTLINE.FOLDLEVEL , | |
| 926 | if the document author does not choose to change it, | |
| 927 | is 10,000. | |
| 928 | This is orders of magnitude greater than the maximum heading level | |
| 929 | which is likely to be used in any document; | |
| 930 | thus the default behaviour will be to show document outlines fully expanded, | |
| 931 | to display all headings defined, | |
| 932 | at all levels within each document. | |
| 933 | .LP | |
| 934 | The setting of | |
| 935 | .CW PDFOUTLINE.FOLDLEVEL | |
| 936 | may be changed at any time; | |
| 937 | however, the effect of each such change may be difficult to predict, | |
| 938 | since it is applied not only to outline entries which are defined | |
| 939 | .EM after | |
| 940 | the setting is changed, | |
| 941 | but also to any entries which remain in the outline cache, | |
| 942 | .EM at | |
| 943 | this time. | |
| 944 | Therefore, it is recommended that | |
| 945 | .CW PDFOUTLINE.FOLDLEVEL | |
| 946 | should be set | |
| 947 | .EM once , | |
| 948 | at the start of each document; | |
| 949 | if it | |
| 950 | .EM is | |
| 951 | deemed necessary to change it at any other time, | |
| 952 | the outline cache should be flushed, | |
| 953 | .XR pdfsync ), ( | |
| 954 | .EM immediately | |
| 955 | before the change, | |
| 956 | which should immediately preceed a level one heading. | |
| 957 | .NH 3 | |
| 958 | .XN -N multipart-outline -- Outlines for Multipart Documents | |
| 959 | .LP | |
| 960 | When a document outline is created, using the | |
| 961 | .CW pdfhref | |
| 962 | macro, each reference mark is automatically assigned a name, | |
| 963 | composed of a fixed stem followed by a serially generated numeric qualifier. | |
| 964 | This ensures that, for each single part document, every outline reference | |
| 965 | has a uniquely named destination. | |
| 966 | .LP | |
| 967 | As the overall size of the PDF document increases, | |
| 968 | it may become convenient to divide it into smaller, | |
| 969 | individually formatted PostScript\*(rg components, | |
| 970 | which are then assembled, in the appropriate order, | |
| 971 | to create a composite PDF document. | |
| 972 | While this strategy may simplify the overall process of creating and | |
| 973 | editing larger documents, it does introduce a problem in creating | |
| 974 | an overall document outline, | |
| 975 | since each individual PostScript\*(rg component will be assigned | |
| 976 | duplicated sequences of \(lqbookmark\(rq names, | |
| 977 | with each name ultimately referring to multiple locations in the composite document. | |
| 978 | To avoid such reference naming conflicts, the | |
| 979 | .CW pdfhref | |
| 980 | macro allows the user to specify a \(lqtag\(rq, | |
| 981 | which is appended to the automatically generated \(lqbookmark\(rq name; | |
| 982 | this may be used as a discriminating mark, to distinguish otherwise | |
| 983 | similarly named destinations, in different sections of the composite document. | |
| 984 | .LP | |
| 985 | To create a \(lqtagged\(rq document outline, | |
| 986 | the syntax for invocation of the | |
| 987 | .CW pdfhref | |
| 988 | macro is modified, by the inclusion of an optional \(lqtag\(rq specification, | |
| 989 | .EM before | |
| 990 | the nesting level argument, i.e. | |
| 991 | .QP | |
| 992 | .fam C | |
| 993 | .B ".pdfhref O" | |
| 994 | .B -T \& [ | |
| 995 | .I tag >] < | |
| 996 | .I level > < | |
| 997 | .I "descriptive text ..." | |
| 998 | .LP | |
| 999 | The optional | |
| 1000 | .CWI tag > < | |
| 1001 | argument may be composed of any characters of the user's choice; | |
| 1002 | however, its initial character | |
| 1003 | .EM "must not" | |
| 1004 | be any decimal digit, and ideally it should be kept short | |
| 1005 | \(em one or two characters at most. | |
| 1006 | .LP | |
| 1007 | By employing a different tag in each section, | |
| 1008 | the user can ensure that \(lqbookmark\(rq names remain unique, | |
| 1009 | throughout all the sections of a composite document. | |
| 1010 | For example, when using the | |
| 1011 | .CW spdf.tmac | |
| 1012 | macro package, which adds | |
| 1013 | .CW pdfmark | |
| 1014 | capabilities to the standard | |
| 1015 | .CW ms | |
| 1016 | package, | |
| 1017 | .XR using-spdf ), ( | |
| 1018 | the table of contents is collected into a separate PostScript\*(rg section | |
| 1019 | from the main body of the document. | |
| 1020 | In the \(lqbody\(rq section, the document outline is \(lquntagged\(rq, | |
| 1021 | but in the \(lqTable\~of\~Contents\(rq section, a modified version of the | |
| 1022 | .CW TC | |
| 1023 | macro adds an outline entry for the start of the \(lqTable\~of\~Contents\(rq, | |
| 1024 | invoking the | |
| 1025 | .CW pdfhref | |
| 1026 | macro as | |
| 1027 | .QP | |
| 1028 | .CW ".pdfhref O -T T 1 \e\e*[TOC]" | |
| 1029 | .LP | |
| 1030 | to tag the associated outline destination name with the single character suffix, | |
| 1031 | .CW T \(rq. \(lq | |
| 1032 | Alternatively, as in the case of the basic outline, | |
| 1033 | .XR basic-outline ), ( | |
| 1034 | this may equally well be specified as | |
| 1035 | .QP | |
| 1036 | .CW ".pdfbookmark -T T 1 \e\e*[TOC]" | |
| 1037 | .NH 3 | |
| 1038 | .XN Delegation of the Outline Definition | |
| 1039 | .LP | |
| 1040 | Since the most common use of a document outline | |
| 1041 | is to provide a quick method of navigating through a document, | |
| 1042 | using active \(lqhypertext\(rq links to chapter and section headings, | |
| 1043 | it may be convenient to delegate the responsibility of creating the outline | |
| 1044 | to a higher level macro, which is itself used to | |
| 1045 | define and format the section headings. | |
| 1046 | This approach has been adopted in the | |
| 1047 | .CW spdf.tmac | |
| 1048 | package, to be described later, | |
| 1049 | .XR using-spdf ). ( | |
| 1050 | .LP | |
| 1051 | When such an approach is adopted, | |
| 1052 | the user will rarely, if ever, invoke the | |
| 1053 | .CW pdfhref | |
| 1054 | macro directly, to create a document outline. | |
| 1055 | For example, the structure and content of the outline for this document | |
| 1056 | has been exclusively defined, using a combination of the | |
| 1057 | .CW NH | |
| 1058 | macro, from the | |
| 1059 | .CW ms | |
| 1060 | package, to establish the structure, and the | |
| 1061 | .CW XN | |
| 1062 | macro from | |
| 1063 | .CW spdf.tmac , | |
| 1064 | to define the content. | |
| 1065 | In this case, | |
| 1066 | the responsibility for invoking the | |
| 1067 | .CW pdfhref | |
| 1068 | macro, to create the document outline, | |
| 1069 | is delegated to the | |
| 1070 | .CW XN | |
| 1071 | macro. | |
| 1072 | .NH 2 | |
| 1073 | .XN -N pdfhref -- Adding Reference Marks and Links | |
| 1074 | .LP | |
| 1075 | .pdfhref F SECREF | |
| 1076 | .ds SECREF.BEGIN Section | |
| 1077 | .pdfhref L -D add-outline | |
| 1078 | .pdfhref F | |
| 1079 | has shown how the | |
| 1080 | .CW pdfhref | |
| 1081 | macro may be used to create a PDF document outline. | |
| 1082 | While this is undoubtedly a powerful capability, | |
| 1083 | it is by no means the only trick in the repertoire of this versatile macro. | |
| 1084 | .LP | |
| 1085 | The macro name, | |
| 1086 | .CW pdfhref , | |
| 1087 | which is a contraction of \(lqPDF HyperText Reference\(rq, | |
| 1088 | indicates that the general purpose of this macro is to define | |
| 1089 | .EM any | |
| 1090 | type of dynamic reference mark, within a PDF document. | |
| 1091 | Its generalised usage syntax takes the form | |
| 1092 | .QP | |
| 1093 | .fam C | |
| 1094 | .B .pdfhref | |
| 1095 | .BI class > < | |
| 1096 | .I "-options ...\&" ] [ | |
| 1097 | [--] | |
| 1098 | .I "descriptive text ...\&" ] [ | |
| 1099 | .LP | |
| 1100 | where | |
| 1101 | .CW <\f(CIclass\fP> | |
| 1102 | represents a required single character argument, | |
| 1103 | which defines the specific reference operation to be performed, | |
| 1104 | and may be selected from:\(en | |
| 1105 | .QS | |
| 1106 | .IP \*[= O] | |
| 1107 | Add an entry to the document outline. | |
| 1108 | This operation has been described earlier, | |
| 1109 | .XR add-outline ). ( | |
| 1110 | .IP \*[= M] | |
| 1111 | Place a \(lqnamed destination\(rq reference mark at the current output position, | |
| 1112 | in the current PDF document, | |
| 1113 | .XR mark-dest ). ( | |
| 1114 | .IP \*[= D] | |
| 1115 | Specify the content of a PDF document reference dictionary entry; | |
| 1116 | typically, such entries are generated automatically, | |
| 1117 | by transformation of the intermediate output resulting from the use of | |
| 1118 | .CW pdfhref | |
| 1119 | .CWB M \& \& \(rq, \(lq | |
| 1120 | with the | |
| 1121 | .CWB -X \& \& \(rq \(lq | |
| 1122 | modifier, | |
| 1123 | .XR create-map ); ( | |
| 1124 | however, it is also possible to specify such entries manually, | |
| 1125 | .XR user-format ). ( | |
| 1126 | .IP \*[= L] | |
| 1127 | Insert an active link to a named destination, | |
| 1128 | .XR link-named ), ( | |
| 1129 | at the current output position in the current PDF document, | |
| 1130 | such that when the reader clicks on the link text, | |
| 1131 | the document view changes to show the location of the named destination. | |
| 1132 | .IP \*[= W] | |
| 1133 | Insert an active link to a \(lqweb\(rq resource, | |
| 1134 | .XR add-weblink ), ( | |
| 1135 | at the current output position in the current PDF document. | |
| 1136 | This is effectively the same as using the | |
| 1137 | .CWB L \& \& \(rq \(lq | |
| 1138 | operator to establish a link to a named destination in another PDF document, | |
| 1139 | .XR link-extern ), ( | |
| 1140 | except that in this case, the destination is specified by a | |
| 1141 | \(lquniform resource identifier\(rq, or | |
| 1142 | .CW URI ; | |
| 1143 | this may represent any Internet or local resource | |
| 1144 | which can be specified in this manner. | |
| 1145 | .IP \*[= F] | |
| 1146 | Specify a user defined macro, to be called by | |
| 1147 | .CW pdfhref , | |
| 1148 | when formatting the text in the active region of a link, | |
| 1149 | .XR set-format ). ( | |
| 1150 | .IP \*[= Z] | |
| 1151 | Define the absolute position on the physical PDF output page, | |
| 1152 | where the \(lqhot\(hyspot\(rq associated with an active link is to be placed. | |
| 1153 | Invoked in pairs, marking the starting and ending PDF page co\(hyordinates | |
| 1154 | for each link \(lqhot\(hyspot\(rq, this operator is rarely, if ever, | |
| 1155 | specified directly by the user; | |
| 1156 | rather, appropriate | |
| 1157 | .CW pdfhref | |
| 1158 | .CWB Z \& \& \(rq \(lq | |
| 1159 | specifications are inserted automatically into the document reference map | |
| 1160 | during the PDF document formatting process, | |
| 1161 | .XR create-map ). ( | |
| 1162 | .IP \*[= I] | |
| 1163 | Initialise support for | |
| 1164 | .CW pdfhref | |
| 1165 | features. | |
| 1166 | The current | |
| 1167 | .CW pdfhref | |
| 1168 | implementation provides only one such feature which requires initialisation | |
| 1169 | \(em a helper macro which must be attached to a user supplied page trap handler, | |
| 1170 | in order to support mapping of reference \(lqhot\(hyspots\(rq | |
| 1171 | which extend through a page transition; | |
| 1172 | .XR page-trap ). ( | |
| 1173 | .QE | |
| 1174 | .NH 3 | |
| 1175 | .XN Optional Features of the \F[C]pdfhref\F[] Macro | |
| 1176 | .LP | |
| 1177 | The behaviour of a number of the | |
| 1178 | .CW pdfhref | |
| 1179 | macro operations can be modified, | |
| 1180 | by including | |
| 1181 | .EM "option specifiers" \(rq \(lq | |
| 1182 | after the operation specifying argument, | |
| 1183 | but | |
| 1184 | .EM before | |
| 1185 | any other arguments normally associated with the operation. | |
| 1186 | In | |
| 1187 | .EM all | |
| 1188 | cases, an option is specified by an | |
| 1189 | .EM "option flag" \(rq, \(lq | |
| 1190 | comprising an initial hyphen, | |
| 1191 | followed by one or two option identifying characters. | |
| 1192 | Additionally, | |
| 1193 | .EM some | |
| 1194 | options require | |
| 1195 | .EM "exactly one" | |
| 1196 | option argument; | |
| 1197 | for these options, the argument | |
| 1198 | .EM must | |
| 1199 | be specified, and it | |
| 1200 | .EM must | |
| 1201 | be separated from the preceding option flag by one or more | |
| 1202 | .EM spaces , | |
| 1203 | (tabs | |
| 1204 | .EM "must not" | |
| 1205 | be used). | |
| 1206 | It may be noted that this paradigm for specifying options | |
| 1207 | is reminiscent of most | |
| 1208 | .SM | |
| 1209 | UNIX\(tm | |
| 1210 | .LG | |
| 1211 | shells; however, in the case of the | |
| 1212 | .CW pdfhref | |
| 1213 | macro, omission of the space separating an option flag from its argument is | |
| 1214 | .EM never | |
| 1215 | permitted. | |
| 1216 | .LP | |
| 1217 | A list of | |
| 1218 | .EM all | |
| 1219 | general purpose options supported by the | |
| 1220 | .CW pdfhref | |
| 1221 | macro is given below. | |
| 1222 | Note that not all options are supported for all | |
| 1223 | .CW pdfhref | |
| 1224 | operations; the operations affected by each option are noted in the list. | |
| 1225 | For | |
| 1226 | .EM most | |
| 1227 | operations, if an unsupported option is specified, | |
| 1228 | it will be silently ignored; however, this behaviour should | |
| 1229 | not be relied upon. | |
| 1230 | .LP | |
| 1231 | The general purpose options, supported by the | |
| 1232 | .CW pdfhref | |
| 1233 | macro, are:\(en | |
| 1234 | .QS | |
| 1235 | .IP \*[= -N\0 name > <] | |
| 1236 | Allows the | |
| 1237 | .CWI name > < | |
| 1238 | associated with a PDF reference destination | |
| 1239 | to be defined independently from the following text, | |
| 1240 | which describes the reference. | |
| 1241 | This option affects only the | |
| 1242 | .CWB M \& \& \(rq \(lq | |
| 1243 | operation of the | |
| 1244 | .CW pdfhref | |
| 1245 | macro, | |
| 1246 | .XR mark-dest ). ( | |
| 1247 | .IP \*[= -E] | |
| 1248 | Also used exclusively with the | |
| 1249 | .CWB M \& \& \(rq \(lq | |
| 1250 | operator, the | |
| 1251 | .CWB -E | |
| 1252 | option causes any specified | |
| 1253 | .CWI descriptive \& \& \~\c | |
| 1254 | .CWI text | |
| 1255 | arguments, | |
| 1256 | .XR mark-dest ), ( | |
| 1257 | to be copied, or | |
| 1258 | .EM echoed , | |
| 1259 | in the body text of the document, | |
| 1260 | at the point where the reference mark is defined; | |
| 1261 | (without the | |
| 1262 | .CWB -E | |
| 1263 | option, such | |
| 1264 | .CWI descriptive \& \& \~\c | |
| 1265 | .CWI text | |
| 1266 | will appear | |
| 1267 | .EM only | |
| 1268 | at points where links to the reference mark are placed, | |
| 1269 | and where the standard reference display format, | |
| 1270 | .XR set-format ), ( | |
| 1271 | is used). | |
| 1272 | .IP \*[= -D\0 dest > <] | |
| 1273 | Specifies the | |
| 1274 | .CW URI , | |
| 1275 | or the destination name associated with a PDF active link, | |
| 1276 | independently of the following text, | |
| 1277 | which describes the link and demarcates the link \(lqhot\(hyspot\(rq. | |
| 1278 | This option affects the behaviour of the | |
| 1279 | .CW pdfhref | |
| 1280 | macro's | |
| 1281 | .CWB L \& \& \(rq \(lq | |
| 1282 | and | |
| 1283 | .CWB W \& \& \(rq \(lq | |
| 1284 | operations. | |
| 1285 | .IP | |
| 1286 | When used with the | |
| 1287 | .CWB L \& \& \(rq \(lq | |
| 1288 | operator, the | |
| 1289 | .CWI dest > < | |
| 1290 | argument must specify a PDF \(lqnamed destination\(rq, | |
| 1291 | as defined using | |
| 1292 | .CW pdfhref | |
| 1293 | with the | |
| 1294 | .CWB M \& \& \(rq \(lq | |
| 1295 | operator. | |
| 1296 | .IP | |
| 1297 | When used with the | |
| 1298 | .CWB W \& \& \(rq \(lq | |
| 1299 | operator, | |
| 1300 | .CWI dest > < | |
| 1301 | must specify a link destination in the form of a | |
| 1302 | \(lquniform resource identifier\(rq, or | |
| 1303 | .CW URI , | |
| 1304 | .XR add-weblink ). ( | |
| 1305 | .IP \*[= -F\0 file > <] | |
| 1306 | When used with the | |
| 1307 | .CWB L \& \& \(rq \(lq | |
| 1308 | .CW pdfhref | |
| 1309 | operator, | |
| 1310 | .CWI file > < | |
| 1311 | specifies an external PDF file in which the named destination | |
| 1312 | for the link reference is defined. | |
| 1313 | This option | |
| 1314 | .EM must | |
| 1315 | be specified with the | |
| 1316 | .CWB L \& \& \(rq \(lq | |
| 1317 | operator, | |
| 1318 | to create a link to a destination in a different PDF document; | |
| 1319 | when the | |
| 1320 | .CWB L \& \& \(rq \(lq | |
| 1321 | operator is used | |
| 1322 | .EM without | |
| 1323 | this option, the link destination is assumed to be defined | |
| 1324 | within the same document. | |
| 1325 | .IP \*[= -P\0 \(dqprefix\(hytext\(dq > <] | |
| 1326 | Specifies | |
| 1327 | .CWI \(dqprefix\(hytext\(dq > < | |
| 1328 | to be attached to the | |
| 1329 | .EM start | |
| 1330 | of the text describing an active PDF document link, | |
| 1331 | with no intervening space, but without itself being included in the | |
| 1332 | active area of the link \(lqhot\(hyspot\(rq; | |
| 1333 | it is effective with the | |
| 1334 | .CWB L \& \& \(rq \(lq | |
| 1335 | and | |
| 1336 | .CWB W \& \& \(rq \(lq | |
| 1337 | .CW pdfhref | |
| 1338 | operators. | |
| 1339 | .IP | |
| 1340 | Typically, this option would be used to insert punctuation before | |
| 1341 | the link \(lqhot\(hyspot\(rq. | |
| 1342 | Thus, there is little reason for the inclusion of spaces in | |
| 1343 | .CWI \(dqprefix\(hytext\(dq > < ; | |
| 1344 | however, if such space is required, then the enclosing double quotes | |
| 1345 | .EM must | |
| 1346 | be specified, as indicated. | |
| 1347 | .IP \*[= -A\0 \(dqaffixed\(hytext\(dq > <] | |
| 1348 | Specifies | |
| 1349 | .CWI \(dqaffixed\(hytext\(dq > < | |
| 1350 | to be attached to the | |
| 1351 | .EM end | |
| 1352 | of the text describing an active PDF document link, | |
| 1353 | with no intervening space, but without itself being included in the | |
| 1354 | active area of the link \(lqhot\(hyspot\(rq; | |
| 1355 | it is effective with the | |
| 1356 | .CWB L \& \& \(rq \(lq | |
| 1357 | and | |
| 1358 | .CWB W \& \& \(rq \(lq | |
| 1359 | .CW pdfhref | |
| 1360 | operators. | |
| 1361 | .IP | |
| 1362 | Typically, this option would be used to insert punctuation after | |
| 1363 | the link \(lqhot\(hyspot\(rq. | |
| 1364 | Thus, there is little reason for the inclusion of spaces in | |
| 1365 | .CWI \(dqaffixed\(hytext\(dq > < ; | |
| 1366 | however, if such space is required, then the enclosing double quotes | |
| 1367 | .EM must | |
| 1368 | be specified, as indicated. | |
| 1369 | .IP \*[= -T\0 tag > <] | |
| 1370 | When specified with the | |
| 1371 | .CWB O \& \& \(rq \(lq | |
| 1372 | operator, | |
| 1373 | .CWI tag > < | |
| 1374 | is appended to the \(lqbookmark\(rq name assigned to the generated outline entry. | |
| 1375 | This option is | |
| 1376 | .EM required , | |
| 1377 | to distinguish between the series of \(lqbookmark\(rq names generated in | |
| 1378 | individual passes of the | |
| 1379 | .CW groff | |
| 1380 | formatter, when the final PDF document is to be assembled | |
| 1381 | from a number of separately formatted components; | |
| 1382 | .XR multipart-outline ). ( | |
| 1383 | .IP \*[= -X] | |
| 1384 | This | |
| 1385 | .CW pdfhref | |
| 1386 | option is used with either the | |
| 1387 | .CWB M \& \& \(rq \(lq | |
| 1388 | operator, or with the | |
| 1389 | .CWB L \& \& \(rq \(lq | |
| 1390 | operator. | |
| 1391 | .IP | |
| 1392 | When used with the | |
| 1393 | .CWB M \& \& \(rq \(lq | |
| 1394 | operator, | |
| 1395 | .XR mark-dest ), ( | |
| 1396 | it ensures that a cross reference record for the marked destination | |
| 1397 | will be included in the document reference map, | |
| 1398 | .XR export-map ). ( | |
| 1399 | .IP | |
| 1400 | When used with the | |
| 1401 | .CWB L \& \& \(rq \(lq | |
| 1402 | operator, | |
| 1403 | .XR link-named ), ( | |
| 1404 | it causes the reference to be displayed in the standard cross reference format, | |
| 1405 | .XR set-format ), ( | |
| 1406 | but substituting the | |
| 1407 | .CWI descriptive \& \& \~\c | |
| 1408 | .CWI text | |
| 1409 | specified in the | |
| 1410 | .CW pdfhref \& \(lq | |
| 1411 | .CW L \(rq | |
| 1412 | argument list, | |
| 1413 | for the description specified in the document reference map. | |
| 1414 | .IP \*[= --] | |
| 1415 | Marks the end of the option specifiers. | |
| 1416 | This may be used with all | |
| 1417 | .CW pdfhref | |
| 1418 | operations which accept options, to prevent | |
| 1419 | .CW pdfhref | |
| 1420 | from interpreting any following arguments as option specifiers, | |
| 1421 | even if they would otherwise be interpreted as such. | |
| 1422 | It is also useful when the argument list to | |
| 1423 | .CW pdfhref | |
| 1424 | contains special characters \(em any special character, | |
| 4d3e9548 | 1425 | which is not valid in a |
| 465b256c JR |
1426 | .CW groff |
| 1427 | macro name, will cause a parsing error, if | |
| 1428 | .CW pdfhref | |
| 1429 | attempts to match it as a possible option flag; | |
| 1430 | using the | |
| 1431 | .CW -- \(rq \(lq | |
| 1432 | flag prevents this, so suppressing the | |
| 1433 | .CW groff | |
| 1434 | warning message, which would otherwise ensue. | |
| 1435 | .IP | |
| 1436 | Using this flag after | |
| 1437 | .EM all | |
| 1438 | sequences of macro options is recommended, | |
| 1439 | even when it is not strictly necessary, | |
| 1440 | if only for the entirely cosmetic benefit of visually separating | |
| 1441 | the main argument list from the sequence of preceding options. | |
| 1442 | .QE | |
| 1443 | .LP | |
| 1444 | In addition to the | |
| 1445 | .CW pdfhref | |
| 1446 | options listed above, a supplementary set of two character options are defined. | |
| 1447 | These supplementary options, listed below, are intended for use with the | |
| 1448 | .CWB L \& \& \(rq \(lq | |
| 1449 | operator, in conjunction with the | |
| 1450 | .CWB -F \& \& \~\c | |
| 1451 | .CWBI file > < | |
| 1452 | option, to specify alternate file names, | |
| 1453 | in formats compatible with the file naming conventions | |
| 1454 | of alternate operating systems; | |
| 1455 | they will be silently ignored, if used in any other context. | |
| 1456 | .LP | |
| 1457 | The supported alternate file name options, | |
| 1458 | which are ignored if the | |
| 1459 | .CWB -F \& \& \~\c | |
| 1460 | .CWBI file > < | |
| 1461 | option is not specified, are:\(en | |
| 1462 | .QS | |
| 1463 | .IP \*[= -DF\0 dos\(hyfile > <] | |
| 1464 | Specifies the name of the file in which a link destination is defined, | |
| 1465 | using the file naming semantics of the | |
| 1466 | .CW MS\(hyDOS \*(rg | |
| 1467 | operating system. | |
| 1468 | When the PDF document is read on a machine | |
| 1469 | where the operating system uses the | |
| 1470 | .CW MS\(hyDOS \*(rg | |
| 1471 | file system, then | |
| 1472 | .CWI dos\(hyfile > < | |
| 1473 | is used as the name of the file containing the reference destination, | |
| 1474 | overriding the | |
| 1475 | .CWI file > < | |
| 1476 | argument specified with the | |
| 1477 | .CWB -F | |
| 1478 | option. | |
| 1479 | .IP \*[= -MF\0 mac\(hyfile > <] | |
| 1480 | Specifies the name of the file in which a link destination is defined, | |
| 1481 | using the file naming semantics of the | |
| 1482 | .CW Apple \*(rg | |
| 1483 | .CW Macintosh \*(rg | |
| 1484 | operating system. | |
| 1485 | When the PDF document is read on a machine | |
| 1486 | where the operating system uses the | |
| 1487 | .CW Macintosh \*(rg | |
| 1488 | file system, then | |
| 1489 | .CWI mac\(hyfile > < | |
| 1490 | is used as the name of the file containing the reference destination, | |
| 1491 | overriding the | |
| 1492 | .CWI file > < | |
| 1493 | argument specified with the | |
| 1494 | .CWB -F | |
| 1495 | option. | |
| 1496 | .IP \*[= -UF\0 unix\(hyfile > <] | |
| 1497 | Specifies the name of the file in which a link destination is defined, | |
| 1498 | using the file naming semantics of the | |
| 1499 | .CW UNIX \(tm | |
| 1500 | operating system. | |
| 1501 | When the PDF document is read on a machine | |
| 1502 | where the operating system uses | |
| 1503 | .CW POSIX | |
| 1504 | file naming semantics, then | |
| 1505 | .CWI unix\(hyfile > < | |
| 1506 | is used as the name of the file containing the reference destination, | |
| 1507 | overriding the | |
| 1508 | .CWI file > < | |
| 1509 | argument specified with the | |
| 1510 | .CWB -F | |
| 1511 | option. | |
| 1512 | .IP \*[= -WF\0 win\(hyfile > <] | |
| 1513 | Specifies the name of the file in which a link destination is defined, | |
| 1514 | using the file naming semantics of the | |
| 1515 | .CW MS\(hyWindows \*(rg | |
| 1516 | 32\(hybit operating system. | |
| 1517 | When the PDF document is read on a machine | |
| 1518 | where the operating system uses any of the | |
| 1519 | .CW MS\(hyWindows \*(rg | |
| 1520 | file systems, with long file name support, then | |
| 1521 | .CWI win\(hyfile > < | |
| 1522 | is used as the name of the file containing the reference destination, | |
| 1523 | overriding the | |
| 1524 | .CWI file > < | |
| 1525 | argument specified with the | |
| 1526 | .CWB -F | |
| 1527 | option. | |
| 1528 | .QE | |
| 1529 | .NH 3 | |
| 1530 | .XN -N mark-dest -- Marking a Reference Destination | |
| 1531 | .LP | |
| 1532 | The | |
| 1533 | .CW pdfhref | |
| 1534 | macro may be used to create active links to any Internet resource, | |
| 1535 | specified by its | |
| 1536 | .CW URI , | |
| 1537 | or to any \(lqnamed destination\(rq, | |
| 1538 | either within the same document, or in another PDF document. | |
| 1539 | Although the PDF specification allows link destinations to be defined | |
| 1540 | in terms of a page number, and an associated view specification, | |
| 1541 | this style of reference is not currently supported by the | |
| 1542 | .CW pdfhref | |
| 1543 | macro, because it is not possible to adequately bind the specification | |
| 1544 | for the destination with the intended reference context. | |
| 1545 | .LP | |
| 1546 | References to Internet resources are interpreted in accordance with the | |
| 1547 | .CW W3C | |
| 1548 | standard for defining a | |
| 1549 | .CW URI ; | |
| 1550 | hence the only prerequisite, for creating a link to any Internet resource, | |
| 1551 | is that the | |
| 1552 | .CW URI | |
| 1553 | be properly specified, when declaring the reference; | |
| 1554 | .XR add-weblink ). ( | |
| 1555 | In the case of references to \(lqnamed destinations\(rq in PDF documents, | |
| 1556 | however, it is necessary to provide a mechanism for creating such | |
| 1557 | \(lqnamed destinations\(rq. | |
| 1558 | This may be accomplished, by invoking the | |
| 1559 | .CW pdfhref | |
| 1560 | macro in the form | |
| 1561 | .QP | |
| 1562 | .fam C | |
| 1563 | .B ".pdfhref M" | |
| 1564 | .B -N \& [ | |
| 1565 | .I name >] < | |
| 1566 | .B -X ] [ | |
| 1567 | .B -E ] [ | |
| 1568 | .I "descriptive text ...\&" ] [ | |
| 1569 | .LP | |
| 1570 | This creates a \(lqnamed destination\(rq reference mark, with its name specified by | |
| 1571 | .CWI name > < , | |
| 1572 | or, if the | |
| 1573 | .CWB -N | |
| 1574 | option is not specified, by the first word of | |
| 1575 | .CWI descriptive \& \& \~\c | |
| 1576 | .CWI text \& \& ; | |
| 1577 | (note that this imposes the restriction that, | |
| 1578 | if the | |
| 1579 | .CWB -N | |
| 1580 | option is omitted, then | |
| 1581 | .EM "at least" | |
| 1582 | one word of | |
| 1583 | .CWI descriptive \& \& \~\c | |
| 1584 | .CWI text | |
| 1585 | .EM must | |
| 1586 | be specified). | |
| 1587 | Additionally, a reference view will be automatically defined, | |
| 1588 | and associated with the reference mark, | |
| 1589 | .XR pdfhref-view ), ( | |
| 1590 | .\" and, if any | |
| 1591 | .\" .CWI descriptive | |
| 1592 | .\" .CWI text | |
| 1593 | .\" is specified, or the | |
| 1594 | and, if the | |
| 1595 | .CWB -X | |
| 1596 | option is specified, and no document cross reference map has been imported, | |
| 1597 | .XR import-map ), ( | |
| 1598 | then a cross reference mapping record, | |
| 1599 | .XR export-map ), ( | |
| 1600 | will be written to the | |
| 1601 | .CW stdout | |
| 1602 | stream; | |
| 1603 | this may be captured, and subsequently used to generate a cross reference map | |
| 1604 | for the document, | |
| 1605 | .XR create-map ). ( | |
| 1606 | .LP | |
| 1607 | When a \(lqnamed destination\(rq reference mark is created, using the | |
| 1608 | .CW pdfhref | |
| 1609 | macro's | |
| 1610 | .CWB M \& \& \(rq \(lq | |
| 1611 | operator, there is normally no visible effect in the formatted document; any | |
| 1612 | .CWI descriptive \& \& \~\c | |
| 1613 | .CWI text | |
| 1614 | which is specified will simply be stored in the cross reference map, | |
| 1615 | for use when a link to the reference mark is created. | |
| 1616 | This default behaviour may be changed, by specifying the | |
| 1617 | .CWB -E | |
| 1618 | option, which causes any specified | |
| 1619 | .CWI descriptive \& \& \~\c | |
| 1620 | .CWI text | |
| 1621 | to be \(lqechoed\(rq in the document text, | |
| 1622 | at the point where the reference mark is placed, | |
| 1623 | in addition to its inclusion in the cross reference map. | |
| 1624 | .NH 4 | |
| 1625 | .XN -N export-map -- Mapping a Destination for Cross Referencing | |
| 1626 | .LP | |
| 1627 | Effective cross referencing of | |
| 1628 | .EM any | |
| 1629 | document formatted by | |
| 1630 | .CW groff | |
| 1631 | requires multiple pass formatting. | |
| 1632 | Details of how this multiple pass formatting may be accomplished, | |
| 1633 | when working with the | |
| 1634 | .CW pdfmark | |
| 1635 | macros, will be discussed later, | |
| 1636 | .XR do-xref ); ( | |
| 1637 | at this stage, the discussion will be restricted to the initial preparation, | |
| 1638 | which is required at the time when the cross reference destinations are defined. | |
| 1639 | .LP | |
| 1640 | The first stage, in the process of cross referencing a document, | |
| 1641 | is the generation of a cross reference map. | |
| 1642 | Again, the details of | |
| 1643 | .EM how | |
| 1644 | the cross reference map is generated will be discussed in | |
| 1645 | .pdfhref F SECREF L -D do-xref -A ; | |
| 1646 | .pdfhref F | |
| 1647 | however, it is important to recognise that | |
| 1648 | .EM what | |
| 1649 | content is included in the cross reference map is established | |
| 1650 | when the reference destination is defined \(em it is derived | |
| 1651 | from the reference data exported on the | |
| 1652 | .CW stderr | |
| 1653 | stream by the | |
| 1654 | .CW pdfhref | |
| 1655 | macro, when it is invoked with the | |
| 1656 | .CWB M \& \& \(rq \(lq | |
| 1657 | operator, and is controlled by whatever definition of the string | |
| 1658 | .CW PDFHREF.INFO | |
| 1659 | is in effect, when the | |
| 1660 | .CW pdfhref | |
| 1661 | macro is invoked. | |
| 1662 | .LP | |
| 1663 | The initial default setting of | |
| 1664 | .CW PDFHREF.INFO | |
| 1665 | is | |
| 1666 | .QP | |
| 1667 | .CW ".ds PDFHREF.INFO page \e\en% \e\e$*" | |
| 1668 | .LP | |
| 1669 | which ensures that the cross reference map will contain | |
| 1670 | at least a page number reference, supplemented by any | |
| 1671 | .CWI descriptive \& \& \~\c | |
| 1672 | .CWI text | |
| 1673 | which is specified for the reference mark, as defined by the | |
| 1674 | .CW pdfhref | |
| 1675 | macro, with its | |
| 1676 | .CWB M \& \& \(rq \(lq | |
| 1677 | operator; this may be redefined by the user, | |
| 1678 | to export additional cross reference information, | |
| 1679 | or to modify the default format for cross reference links, | |
| 1680 | .XR set-format ). ( | |
| 1681 | .NH 4 | |
| 1682 | .XN -N pdfhref-view -- Associating a Document View with a Reference Mark | |
| 1683 | .LP | |
| 1684 | In the same manner as each document outline reference, defined by the | |
| 1685 | .CW pdfhref | |
| 1686 | macro with the | |
| 1687 | .CWB O \& \& \(rq \(lq | |
| 1688 | operator, | |
| 1689 | .XR add-outline ), ( | |
| 1690 | has a specific document view associated with it, | |
| 1691 | each reference destination marked by | |
| 1692 | .CW pdfhref | |
| 1693 | with the | |
| 1694 | .CWB M \& \& \(rq \(lq | |
| 1695 | operator, requires an associated document view specification. | |
| 1696 | .LP | |
| 1697 | The mechanism whereby a document view is associated with a reference mark | |
| 1698 | is entirely analogous to that employed for outline references, | |
| 1699 | .XR outline-view ), ( | |
| 1700 | except that the | |
| 1701 | .CW PDFHREF.VIEW | |
| 1702 | string specification is used, in place of the | |
| 1703 | .CW PDFBOOKMARK.VIEW | |
| 1704 | specification. | |
| 1705 | Thus, the reference view is defined in terms of:\(en | |
| 1706 | .QS | |
| 1707 | .IP \*[= PDFHREF.VIEW] | |
| 1708 | A string, | |
| 1709 | establishing the position of the reference mark within the viewing window, | |
| 1710 | and the magnification at which the document will be viewed, | |
| 1711 | at the location of the marked reference destination; | |
| 1712 | by default, it is defined by | |
| 1713 | .RS | |
| 1714 | .QP | |
| 1715 | .CW ".ds PDFHREF.VIEW /FitH \e\en[PDFPAGE.Y] u" | |
| 1716 | .RE | |
| 1717 | .IP | |
| 1718 | which displays the reference destination at the top of the viewing window, | |
| 1719 | with the magnification set to fit the page width to the width of the window. | |
| 1720 | .IP \*[= PDFHREF.VIEW.LEADING] | |
| 1721 | A numeric register, | |
| 1722 | specifying additional spacing, to be placed between the top of the display | |
| 1723 | window and the actual position at which the location of the reference | |
| 1724 | destination appears within the window. | |
| 1725 | This register is shared with the view specification for outline references, | |
| 1726 | and thus has the same default initial setting, | |
| 1727 | .RS | |
| 1728 | .QP | |
| 1729 | .CW ".nr PDFHREF.VIEW.LEADING 5.0p" | |
| 1730 | .RE | |
| 1731 | .IP | |
| 1732 | as in the case of outline reference views. | |
| 1733 | .IP | |
| 1734 | Again, notice that | |
| 1735 | .CW PDFHREF.VIEW.LEADING | |
| 1736 | does not represent true typographic \(lqleading\(rq, | |
| 1737 | since any preceding text, set in the specified display space, | |
| 1738 | will be visible at the top of the viewing window, | |
| 1739 | when the reference is selected. | |
| 1740 | .QE | |
| 1741 | .LP | |
| 1742 | Just as the view associated with outline references may be changed, | |
| 1743 | by redefining | |
| 1744 | .CW PDFBOOKMARK.VIEW , | |
| 1745 | so the view associated with marked reference destinations may be changed, | |
| 1746 | by redefining | |
| 1747 | .CW PDFHREF.VIEW , | |
| 1748 | and, if desired, | |
| 1749 | .CW PDFHREF.VIEW.LEADING ; | |
| 1750 | such changes will become effective for all reference destinations marked | |
| 1751 | .EM after | |
| 1752 | these definitions are changed. | |
| 1753 | (Notice that, since the specification of | |
| 1754 | .CW PDFHREF.VIEW.LEADING | |
| 1755 | is shared by both outline reference views and marked reference views, | |
| 1756 | if it is changed, then the views for | |
| 1757 | .EM both | |
| 1758 | reference types are changed accordingly). | |
| 1759 | .LP | |
| 1760 | It may again be noted, that the | |
| 1761 | .CW PDFPAGE.Y | |
| 1762 | register is used in the definition of | |
| 1763 | .CW PDFHREF.VIEW , | |
| 1764 | just as it is in the definition of | |
| 1765 | .CW PDFBOOKMARK.VIEW ; | |
| 1766 | all comments in | |
| 1767 | .pdfhref F SECREF L -D outline-view | |
| 1768 | .pdfhref F | |
| 1769 | relating to its use, and indeed to page position computations in general, | |
| 1770 | apply equally to marked reference views and to outline reference views. | |
| 1771 | .NH 3 | |
| 1772 | .XN -N link-named -- Linking to a Marked Reference Destination | |
| 1773 | .LP | |
| 1774 | Any named destination, such as those marked by the | |
| 1775 | .CW pdfhref | |
| 1776 | macro, using it's | |
| 1777 | .CWB M \& \& \(rq \(lq | |
| 1778 | operator, may be referred to from any point in | |
| 1779 | .EM any | |
| 1780 | PDF document, using an | |
| 1781 | .EM "active link" ; | |
| 1782 | such active links are created by again using the | |
| 1783 | .CW pdfhref | |
| 1784 | macro, but in this case, with the | |
| 1785 | .CWB L \& \& \(rq \(lq | |
| 1786 | operator. | |
| 1787 | This operator provides support for two distinct cases, | |
| 1788 | depending on whether the reference destination is defined in | |
| 1789 | the same document as the link, | |
| 1790 | .XR link-intern ), ( | |
| 1791 | or is defined as a named destination in a different PDF document, | |
| 1792 | .XR link-extern ). ( | |
| 1793 | .NH 4 | |
| 1794 | .XN -N link-intern -- References within a Single PDF Document | |
| 1795 | .LP | |
| 1796 | The general syntactic form for invoking the | |
| 1797 | .CW pdfhref | |
| 1798 | macro, | |
| 1799 | when creating a link to a named destination within the same PDF document is | |
| 1800 | .QP | |
| 1801 | .fam C | |
| 1802 | .B .pdfhref | |
| 1803 | .B L | |
| 1804 | .B -D \& [ | |
| 1805 | .BI dest-name >] < | |
| 1806 | .B -P \& [ | |
| 1807 | .BI prefix-text >] < | |
| 1808 | .B -A \& [ | |
| 1809 | .BI affixed-text >] < | |
| 1810 | \e | |
| 1811 | .br | |
| 1812 | \0\0\0 | |
| 1813 | .B -X ] [ | |
| 1814 | .B -- ] [ | |
| 1815 | .I "descriptive text ...\&" ] [ | |
| 1816 | .LP | |
| 1817 | where | |
| 1818 | .CWI dest-name > < | |
| 1819 | specifies the name of the link destination, | |
| 1820 | as specified using the | |
| 1821 | .CW pdfhref | |
| 1822 | .CWB M \& \& \(rq \(lq | |
| 1823 | operation; (it may be defined either earlier in the document, | |
| 1824 | to create a backward reference, or later, to create a forward reference). | |
| 1825 | .\" | |
| 1826 | .\" Here's a example of how to add an iconic annotation. | |
| 1827 | .\" | |
| 1828 | .\".pdfnote -T "Internal Cross References" \ | |
| 1829 | .\" This description is rather terse, and could benefit from \ | |
| 1830 | .\" the inclusion of an example. | |
| 1831 | .LP | |
| 1832 | If any | |
| 1833 | .CWI descriptive \& \& \~\c | |
| 1834 | .CWI text | |
| 1835 | arguments are specified, then they will be inserted into the | |
| 1836 | .CW groff | |
| 1837 | output stream, to define the text appearing in the \(lqhot\(hyspot\(rq | |
| 1838 | region of the link; | |
| 1839 | this will be printed in the link colour specified by the string, | |
| 1840 | .CW PDFHREF.TEXT.COLOUR , | |
| 1841 | which is described in | |
| 1842 | .XR-NO-PREFIX set-colour . | |
| 1843 | If the | |
| 1844 | .CWB -X | |
| 1845 | option is also specified, then the | |
| 1846 | .CWI descriptive \& \& \~\c | |
| 1847 | .CWI text | |
| 1848 | will be augmented, by prefacing it with page and section number indicators, | |
| 1849 | in accordance with the reference formatting rules which are in effect, | |
| 1850 | .XR set-format ); ( | |
| 1851 | such indicators will be included within the active link region, | |
| 1852 | and will also be printed in the link colour. | |
| 1853 | .LP | |
| 1854 | Note that | |
| 1855 | .EM either | |
| 1856 | the | |
| 1857 | .CWB -D \& \& \~\c | |
| 1858 | .CWBI dest\(hyname > < | |
| 1859 | option, | |
| 1860 | .EM or | |
| 1861 | the | |
| 1862 | .CWI descriptive \& \& \~\c | |
| 1863 | .CWI text | |
| 1864 | arguments, | |
| 1865 | .EM "but not both" , | |
| 1866 | may be omitted. | |
| 1867 | If the | |
| 1868 | .CWB -D \& \& \~\c | |
| 1869 | .CWBI dest\(hyname > < | |
| 1870 | option is omitted, then the first word of | |
| 1871 | .CWI descriptive \& \& \~\c | |
| 1872 | .CWI text \& \& , | |
| 1873 | i.e.\~all text up to but not including the first space, | |
| 1874 | will be interpreted as the | |
| 1875 | .CWBI dest\(hyname > < | |
| 1876 | for the link; this text will also appear in the running text of the document, | |
| 1877 | within the active region of the link. | |
| 1878 | Alternatively, if the | |
| 1879 | .CWB -D \& \& \~\c | |
| 1880 | .CWBI dest\(hyname > < | |
| 1881 | option | |
| 1882 | .EM is | |
| 1883 | specified, and | |
| 1884 | .CWI descriptive \& \& \~\c | |
| 1885 | .CWI text | |
| 1886 | is not, | |
| 1887 | then the running text which defines the reference, | |
| 1888 | and its active region, | |
| 1889 | will be derived from the reference description which is specified | |
| 1890 | when the named destination is marked, | |
| 1891 | .XR mark-dest ), ( | |
| 1892 | and will be formatted according to the reference formatting rules | |
| 1893 | which are in effect, when the reference is placed, | |
| 1894 | .XR set-format ); ( | |
| 1895 | in this case, it is not necessary to specify the | |
| 1896 | .CWB -X | |
| 1897 | option to activate automatic formatting of the reference \(em it is implied, | |
| 1898 | by the omission of all | |
| 1899 | .CWI descriptive \& \& \~\c | |
| 1900 | .CWI text | |
| 1901 | arguments. | |
| 1902 | .LP | |
| 1903 | The | |
| 1904 | .CWB -P \& \& \~\c | |
| 1905 | .CWBI prefix\(hytext > < | |
| 1906 | and | |
| 1907 | .CWB -A \& \& \~\c | |
| 1908 | .CWBI affixed\(hytext > < | |
| 1909 | options may be used to specify additional text | |
| 1910 | which will be placed before and after the linked text respectively, | |
| 1911 | with no intervening space. | |
| 1912 | Such prefixed and affixed text will be printed in the normal text colour, | |
| 1913 | and will not be included within the active region of the link. | |
| 1914 | This feature is mostly useful for creating parenthetical references, | |
| 1915 | or for placing punctuation adjacent to, | |
| 1916 | but not included within, | |
| 1917 | the text which defines the active region of the link. | |
| 1918 | .LP | |
| 1919 | The operation of the | |
| 1920 | .CW pdfhref | |
| 1921 | macro, when used with its | |
| 1922 | .CWB L \& \& \(rq \(lq | |
| 1923 | operator to place a link to a named PDF destination, | |
| 1924 | may best be illustrated by an example. | |
| 1925 | However, since the appearance of the link will be influenced by | |
| 1926 | factors established when the named destination is marked, | |
| 1927 | .XR mark-dest ), ( | |
| 1928 | and also by the formatting rules in effect when the link is placed, | |
| 1929 | the presentation of a suitable exanple will be deferred, | |
| 1930 | until the formatting mechanism has been explained, | |
| 1931 | .XR set-format ). ( | |
| 1932 | .NH 4 | |
| 1933 | .XN -N link-extern -- References to Destinations in Other PDF Documents | |
| 1934 | .LP | |
| 1935 | The | |
| 1936 | .CW pdfhref | |
| 1937 | macro's | |
| 1938 | .CWB L \& \& \(rq \(lq | |
| 1939 | operator is not restricted to creating reference links | |
| 1940 | within a single PDF document. | |
| 1941 | When the link destination is defined in a different document, | |
| 1942 | then the syntactic form for invoking | |
| 1943 | .CW pdfhref | |
| 1944 | is modified, by the addition of options to specify the | |
| 1945 | name and location of the PDF file in which the destination is defined. | |
| 1946 | Thus, the extended | |
| 1947 | .CW pdfhref | |
| 1948 | syntactic form becomes | |
| 1949 | .QP | |
| 1950 | .fam C | |
| 1951 | .B .pdfhref | |
| 1952 | .B L | |
| 1953 | .B -F | |
| 1954 | .BI file > < | |
| 1955 | .B -D \& [ | |
| 1956 | .BI dest-name >] < | |
| 1957 | \e | |
| 1958 | .br | |
| 1959 | \0\0\0 | |
| 1960 | .B -DF \& [ | |
| 1961 | .BI dos-file >] < | |
| 1962 | .B -MF \& [ | |
| 1963 | .BI mac-file >] < | |
| 1964 | .B -UF \& [ | |
| 1965 | .BI unix-file >] < | |
| 1966 | \e | |
| 1967 | .br | |
| 1968 | \0\0\0 | |
| 1969 | .B -WF \& [ | |
| 1970 | .BI win-file >] < | |
| 1971 | .B -P \& [ | |
| 1972 | .BI prefix-text >] < | |
| 1973 | .B -A \& [ | |
| 1974 | .BI affixed-text >] < | |
| 1975 | \e | |
| 1976 | .br | |
| 1977 | \0\0\0 | |
| 1978 | .B -X ] [ | |
| 1979 | .B -- ] [ | |
| 1980 | .I "descriptive text ...\&" ] [ | |
| 1981 | .LP | |
| 1982 | where the | |
| 1983 | .CWB -F \& \& \~\c | |
| 1984 | .CWBI file > < | |
| 1985 | option serves | |
| 1986 | .EM two | |
| 1987 | purposes: it both indicates to the | |
| 1988 | .CW pdfhref | |
| 1989 | macro that the specified reference destination | |
| 1990 | is defined in an external PDF file, | |
| 1991 | and it also specifies the normal path name, | |
| 1992 | which is to be used to locate this file, | |
| 1993 | when a user selects the reference. | |
| 1994 | .LP | |
| 1995 | In addition to the | |
| 1996 | .CWB -F \& \& \~\c | |
| 1997 | .CWBI file > < | |
| 1998 | option, which | |
| 1999 | .EM must | |
| 2000 | be specified when referring to a destination in an external PDF file, | |
| 2001 | the | |
| 2002 | .CWB -DF \& \& \~\c | |
| 2003 | .CWBI dos\(hyfile > < , | |
| 2004 | .CWB -MF \& \& \~\c | |
| 2005 | .CWBI mac\(hyfile > < , | |
| 2006 | .CWB -UF \& \& \~\c | |
| 2007 | .CWBI unix\(hyfile > < | |
| 2008 | and | |
| 2009 | .CWB -WF \& \& \~\c | |
| 2010 | .CWBI win\(hyfile > < | |
| 2011 | options may be used to specify the location of the file | |
| 2012 | containing the reference destination, | |
| 2013 | in a variety of operating system dependent formats. | |
| 2014 | These options assign their arguments to the | |
| 2015 | .CW /DosFile , | |
| 2016 | .CW /MacFile , | |
| 2017 | .CW /UnixFile | |
| 2018 | and | |
| 2019 | .CW /WinFile | |
| 2020 | keys of the generated | |
| 2021 | .CW pdfmark | |
| 2022 | respectively; thus when any of these options are specified, | |
| 2023 | .EM "in addition to" | |
| 2024 | the | |
| 2025 | .CWB -F \& \& \~\c | |
| 2026 | .CWBI file > < | |
| 2027 | option, and the document is read on the appropriate operating systems, | |
| 2028 | then the path names specified by | |
| 2029 | .CWBI dos\(hyfile > < , | |
| 2030 | .CWBI mac\(hyfile > < , | |
| 2031 | .CWBI unix\(hyfile > < | |
| 2032 | and | |
| 2033 | .CWBI win\(hyfile > < | |
| 2034 | will be searched, | |
| 2035 | .EM instead | |
| 2036 | of the path name specified by | |
| 2037 | .CWBI file > < , | |
| 2038 | for each of the | |
| 2039 | .CW MS\(hyDOS \*(rg, | |
| 2040 | .CW Apple \*(rg | |
| 2041 | .CW Macintosh \*(rg, | |
| 2042 | .CW UNIX \(tm | |
| 2043 | and | |
| 2044 | .CW MS\(hyWindows \*(rg | |
| 2045 | operating systems, respectively; see the | |
| 2046 | .pdfmark-manual , | |
| 2047 | for further details. | |
| 2048 | .LP | |
| 2049 | Other than the use of these additional options, | |
| 2050 | which specify that the reference destination is in an external PDF file, | |
| 2051 | the behaviour of the | |
| 2052 | .CW pdfhref | |
| 2053 | .CWB L \& \& \(rq \(lq | |
| 2054 | operator, with the | |
| 2055 | .CWB -F \& \& \~\c | |
| 2056 | .CWBI file > < | |
| 2057 | option, remains identical to its behaviour | |
| 2058 | .EM without | |
| 2059 | this option, | |
| 2060 | .XR link-intern ), ( | |
| 2061 | with respect to the interpretation of other options, | |
| 2062 | the handling of the | |
| 2063 | .CWI descriptive \& \& \~\c | |
| 2064 | .CWI text | |
| 2065 | arguments, and the formatting of the displayed reference. | |
| 2066 | .LP | |
| 2067 | Once again, since the appearance of the reference is determined by | |
| 2068 | factors specified in the document reference map, | |
| 2069 | and also by the formatting rules in effect when the reference is placed, | |
| 2070 | the presentation of an example of the placing of | |
| 2071 | a reference to an external destination will be deferred, | |
| 2072 | until the formatting mechanism has been explained, | |
| 2073 | .XR set-format ). ( | |
| 2074 | .NH 3 | |
| 2075 | .XN -N add-weblink -- Linking to Internet Resources | |
| 2076 | .LP | |
| 2077 | In addition to supporting the creation of cross references | |
| 2078 | to named destinations in PDF documents, the | |
| 2079 | .CW pdfhref | |
| 2080 | macro also has the capability to create active links to Internet resources, | |
| 2081 | or indeed to | |
| 2082 | .EM any | |
| 2083 | resource which may be specified by a Uniform Resource Identifier, | |
| 2084 | (which is usually abbreviated to the acronym \(lqURI\(rq, | |
| 2085 | and sometimes also referred to as a Uniform Resource Locator, | |
| 2086 | or \(lqURL\(rq). | |
| 2087 | .LP | |
| 2088 | Since the mechanism for creating a link to a URI differs somewhat | |
| 2089 | from that for creating PDF references, the | |
| 2090 | .CW pdfhref | |
| 2091 | macro is invoked with the | |
| 2092 | .CWB W \& \& \(rq \(lq | |
| 2093 | (for \(lqweb\(hylink\(rq) operator, rather than the | |
| 2094 | .CWB L \& \& \(rq \(lq | |
| 2095 | operator; nevertheless, the invocation syntax is similar, having the form | |
| 2096 | .QP | |
| 2097 | .fam C | |
| 2098 | .B .pdfhref | |
| 2099 | .B W | |
| 2100 | .B -D \& [ | |
| 2101 | .BI URI >] < | |
| 2102 | .B -P \& [ | |
| 2103 | .BI prefix-text >] < | |
| 2104 | .B -A \& [ | |
| 2105 | .BI affixed-text >] < | |
| 2106 | \e | |
| 2107 | .br | |
| 2108 | \0\0\0 | |
| 2109 | .B -- ] [ | |
| 2110 | .I "descriptive text ...\&" | |
| 2111 | .LP | |
| 2112 | where the optional | |
| 2113 | .CWB -D | |
| 2114 | .CWBI URI > < | |
| 2115 | modifier specifies the address for the target Internet resource, | |
| 2116 | in any appropriate | |
| 2117 | .EM "Uniform Resource Identifier" | |
| 2118 | format, while the | |
| 2119 | .CWI descriptive | |
| 2120 | .CWI text | |
| 2121 | argument specifies the text which is to appear in the \(lqhot\(hyspot\(rq | |
| 2122 | region, and the | |
| 2123 | .CWB -P | |
| 2124 | .CWBI prefix\(hytext > < | |
| 2125 | and | |
| 2126 | .CWB -A | |
| 2127 | .CWBI affixed\(hytext > < | |
| 2128 | options have the same effect as in the case of local document links, | |
| 2129 | .XR link-intern ). ( | |
| 2130 | .LP | |
| 2131 | Notice that it is not mandatory to include the | |
| 2132 | .CWB -D | |
| 2133 | .CWBI URI > < | |
| 2134 | in the link specification; if it | |
| 2135 | .EM is | |
| 2136 | specified, then it is not necessary for the URI to appear, | |
| 2137 | in the running text of the document \(em the | |
| 2138 | .CWI descriptive | |
| 2139 | .CWI text | |
| 2140 | argument exactly defines the text | |
| 2141 | which will appear within the \(lqhot\(hyspot\(rq region, | |
| 2142 | and this need not include the URI. | |
| 2143 | However, if the | |
| 2144 | .CWB -D \& \& \~\c | |
| 2145 | .CWBI URI > < | |
| 2146 | specification is omitted, then the | |
| 2147 | .CWI descriptive | |
| 2148 | .CWI text | |
| 2149 | argument | |
| 2150 | .EM must | |
| 2151 | be an | |
| 2152 | .EM exact | |
| 2153 | representation of the URI, which | |
| 2154 | .EM will , | |
| 2155 | therefore, appear as the entire content of the \(lqhot\(hyspot\(rq. | |
| 2156 | For example, we could introduce a reference to | |
| 2157 | .pdfhref W -D \*[GROFF-WEBSITE] -A , the groff web site | |
| 2158 | in which the actual URI is concealed, by using mark up such as:\(en | |
| 2159 | .DS I | |
| 2160 | .CW | |
| 2161 | For example, we could introduce a reference to | |
| 2162 | \&.pdfhref W -D \*[GROFF-WEBSITE] -A , the groff web site | |
| 2163 | in which the actual URI is concealed, | |
| 2164 | .DE | |
| 2165 | Alternatively, | |
| 2166 | to refer the reader to the groff web site, | |
| 2167 | making it obvious that the appropriate URI is | |
| 2168 | .pdfhref W -A , \*[GROFF-WEBSITE] | |
| 2169 | the requisite mark up might be:\(en | |
| 2170 | .DS I | |
| 2171 | .CW | |
| 2172 | to refer the reader to the groff web site, | |
| 2173 | making it obvious that the appropriate URI is | |
| 2174 | \&.pdfhref W -A , \*[GROFF-WEBSITE] | |
| 2175 | the requisite mark up might be:\e(en | |
| 2176 | .DE | |
| 2177 | .NH 3 | |
| 2178 | .XN -N set-format -- Establishing a Format for References | |
| 2179 | .LP | |
| 2180 | There are two principal aspects to be addressed, | |
| 2181 | when defining the format to be used when displaying references. | |
| 2182 | Firstly, it is desirable to provide a visual cue, | |
| 2183 | to indicate that the text describing the reference is imbued | |
| 2184 | with special properties \(em it is dynamically linked to the reference | |
| 2185 | destination \(em and secondly, the textual content should | |
| 2186 | describe where the link leads, and ideally, | |
| 2187 | it should also describe the content of the reference destination. | |
| 2188 | .LP | |
| 2189 | The visual cue, | |
| 2190 | that a text region defines a dynamically linked reference, | |
| 2191 | is most commonly provided by printing the text within the active | |
| 2192 | region in a distinctive colour. | |
| 2193 | This technique will be employed automatically by the | |
| 2194 | .CW pdfhref | |
| 2195 | macro \(em | |
| 2196 | .XR set-colour | |
| 2197 | \(em unless the user specifically chooses to adopt, and implement, | |
| 2198 | some alternative strategy. | |
| 2199 | .NH 4 | |
| 2200 | .XN -N set-colour -- Using Colour to Demarcate Link Regions | |
| 2201 | .LP | |
| 2202 | Typically, when a PDF document contains | |
| 2203 | .EM active | |
| 2204 | references to other locations, either within the same document, | |
| 2205 | or even in other documents, or on the World Wide Web, | |
| 2206 | it is usually desirable to make the regions | |
| 2207 | where these active links are placed stand out from the surrounding text. | |
| 2208 | .NH 4 | |
| 2209 | .XN -N user-format -- Specifying Reference Text Explicitly | |
| 2210 | .NH 4 | |
| 2211 | .XN -N auto-format -- Using Automatically Formatted Reference Text | |
| 2212 | .NH 4 | |
| 2213 | .XN -N custom-format -- Customising Automatically Formatted Reference Text | |
| 2214 | .LP | |
| 2215 | It is incumbent on the user, | |
| 2216 | if employing automatic formatting of the displayed reference, | |
| 2217 | .XR set-format ), ( | |
| 2218 | to ensure that an appropriate reference definition | |
| 2219 | is created for the reference destination, | |
| 2220 | and is included in the reference map for the document | |
| 2221 | in which the reference will appear; | |
| 2222 | thus, it may be easiest to | |
| 2223 | .EM always | |
| 2224 | use manual formatting for external references. | |
| 2225 | .NH 3 | |
| 2226 | .XN Problematic Links | |
| 2227 | .LP | |
| 2228 | Irrespective of whether a | |
| 2229 | .CW pdfhref | |
| 2230 | reference is placed using the | |
| 2231 | .CWB L \& \& \(rq \(lq | |
| 2232 | operator, or the | |
| 2233 | .CWB W \& \& \(rq \(lq | |
| 2234 | operator, there may be occasions when the resulting link | |
| 2235 | does function as expected. | |
| 2236 | A number of scenarios, which are known to be troublesome, | |
| 2237 | are described below. | |
| 2238 | .NH 4 | |
| 2239 | .XN -N page-trap -- Links with a Page Transition in the Active Region | |
| 2240 | .LP | |
| 2241 | When a link is placed near the bottom of a page, | |
| 2242 | it is possible that its active region, or \(lqhot\(hyspot\(rq, | |
| 2243 | may extend on to the next page. | |
| 2244 | In this situation, a page trap macro is required | |
| 2245 | to intercept the page transition, and to restart the mapping of | |
| 2246 | the \(lqhot\(hyspot\(rq boundary on the new page. | |
| 2247 | .LP | |
| 2248 | The | |
| 2249 | .CW pdfmark | |
| 2250 | macro package includes a suitable page trap macro, to satisfy this requirement. | |
| 2251 | However, to avoid pre\(hyempting any other requirement the user may have for | |
| 2252 | a page transition trap, this is | |
| 2253 | .EM not | |
| 2254 | installed as an active page trap, | |
| 2255 | unless explicitly requested by the user. | |
| 2256 | .LP | |
| 2257 | To enable proper handling of page transitions, | |
| 2258 | which occur within the active regions of reference links, | |
| 2259 | the user should:\(en | |
| 2260 | .QS | |
| 2261 | .nr ITEM 0 1 | |
| 2262 | .IP \n+[ITEM]. | |
| 2263 | Define a page transition macro, to provide whatever features may be required, | |
| 2264 | when a page transition occurs \(em e.g.\& printing footnotes, | |
| 2265 | adding page footers and headers, etc. | |
| 2266 | This macro should end by setting the output position at the correct | |
| 2267 | vertical page offset, where the printing of running text is to restart, | |
| 2268 | following the page transition. | |
| 2269 | .IP \n+[ITEM]. | |
| 2270 | Plant a trap to invoke this macro, at the appropriate vertical position | |
| 2271 | marking the end of normal running text on each page. | |
| 2272 | .KS | |
| 2273 | .IP \n+[ITEM]. | |
| 2274 | Initialise the | |
| 2275 | .CW pdfhref | |
| 2276 | hook into this page transition trap, by invoking | |
| 2277 | .RS | |
| 2278 | .IP | |
| 2279 | .fam C | |
| 2280 | .B "pdfhref I -PT" | |
| 2281 | .BI macro-name > < | |
| 2282 | .LP | |
| 2283 | where | |
| 2284 | .CWBI macro-name > < | |
| 2285 | is the name of the user supplied page trap macro, | |
| 2286 | to ensure that | |
| 2287 | .CW pdfhref | |
| 2288 | will correctly restart mapping of active link regions, | |
| 2289 | at the start of each new page. | |
| 2290 | .KE | |
| 2291 | .RE | |
| 2292 | .QE | |
| 2293 | .LP | |
| 2294 | It may be observed that this initialisation of the | |
| 2295 | .CW pdfhref | |
| 2296 | page transition hook is, typically, required only once | |
| 2297 | .EM before | |
| 2298 | document formatting begins. | |
| 2299 | Users of document formatting macro packages may reasonably expect that | |
| 2300 | this initialisation should be performed by the macro package itself. | |
| 2301 | Thus, writers of such macro packages which include | |
| 2302 | .CW pdfmark | |
| 2303 | bindings, should provide appropriate initialisation, | |
| 2304 | so relieving the end user of this responsibility. | |
| 2305 | The following example, abstracted from the sample | |
| 2306 | .CW ms | |
| 2307 | binding package, | |
| 2308 | .CW spdf.tmac , | |
| 2309 | illustrates how this may be accomplished:\(en | |
| 2310 | .DS I | |
| 2311 | .CW | |
| 2312 | \&.\e" groff "ms" provides the "pg@bottom" macro, which has already | |
| 2313 | \&.\e" been installed as a page transition trap. To ensure proper | |
| 2314 | \&.\e" mapping of "pdfhref" links which overflow the bottom of any | |
| 2315 | \&.\e" page, we need to install the "pdfhref" page transition hook, | |
| 2316 | \&.\e" as an addendum to this macro. | |
| 2317 | \&. | |
| 2318 | \&.pdfhref I -PT pg@bottom | |
| 2319 | .DE | |
| 2320 | .NH 2 | |
| 2321 | .XN -N add-note -- Annotating a PDF Document using Pop-Up Notes | |
| 2322 | .NH 2 | |
| 2323 | .XN -N pdfsync -- Synchronising Output and \F[C]pdfmark\F[] Contexts | |
| 2324 | .LP | |
| 2325 | It has been noted previously, that the | |
| 2326 | .CW pdfview | |
| 2327 | macro, | |
| 2328 | .XR docview ), ( | |
| 2329 | the | |
| 2330 | .CW pdfinfo | |
| 2331 | macro, | |
| 2332 | .XR docinfo ), ( | |
| 2333 | and the | |
| 2334 | .CW pdfhref | |
| 2335 | macro, when used to create a document outline, | |
| 2336 | .XR add-outline ), ( | |
| 2337 | do not immediately write their | |
| 2338 | .CW pdfmark | |
| 2339 | output to the PostScript\*(rg data stream; | |
| 2340 | instead, they cache their output, in a | |
| 2341 | .CW groff | |
| 2342 | diversion, in the case of the | |
| 2343 | .CW pdfview | |
| 2344 | and | |
| 2345 | .CW pdfinfo | |
| 2346 | macros, or in an ordered collection of strings and numeric registers, | |
| 2347 | in the case of the document outline, | |
| 2348 | until a more appropriate time for copying it out. | |
| 2349 | In the case of | |
| 2350 | .CW pdfview | |
| 2351 | and | |
| 2352 | .CW pdfinfo | |
| 2353 | \(lqmeta\(hydata\(rq, | |
| 2354 | this \(lqmore appropriate time\(rq is explicitly chosen by the user; | |
| 2355 | in the case of document outline data, | |
| 2356 | .EM some | |
| 2357 | cached data may be implicitly written out as the document outline is compiled, | |
| 2358 | but there will | |
| 2359 | .EM always | |
| 2360 | be some remaining data, which must be explicitly flushed out, before the | |
| 2361 | .CW groff | |
| 2362 | formatting process is allowed to complete. | |
| 2363 | .LP | |
| 2364 | To allow the user to choose when cached | |
| 2365 | .CW pdfmark | |
| 2366 | data is to be flushed to the output stream, the | |
| 2367 | .CW pdfmark | |
| 2368 | macro package provides the | |
| 2369 | .CW pdfsync | |
| 2370 | macro, (to synchronise the cache and output states). | |
| 2371 | In its simplest form, it is invoked without arguments, i.e. | |
| 2372 | .QP | |
| 2373 | .fam C | |
| 2374 | .B .pdfsync | |
| 2375 | .LP | |
| 2376 | This form of invocation ensures that | |
| 2377 | .EM both | |
| 2378 | the \(lqmeta\(hydata cache\(rq, containing | |
| 2379 | .CW pdfview | |
| 2380 | and | |
| 2381 | .CW pdfinfo | |
| 2382 | data, | |
| 2383 | .EM and | |
| 2384 | the \(lqoutline cache\(rq, | |
| 2385 | containing any previously uncommitted document outline data, | |
| 2386 | are flushed; ideally, this should be included in a | |
| 2387 | .CW groff | |
| 2388 | \(lqend macro\(rq, to ensure that | |
| 2389 | .EM both | |
| 2390 | caches are flushed, before | |
| 2391 | .CW groff | |
| 2392 | terminates. | |
| 2393 | .LP | |
| 2394 | Occasionally, | |
| 2395 | it may be desirable to flush either the \(lqmeta\(hydata cache\(rq, | |
| 2396 | without affecting the \(lqoutline cache\(rq, or vice\(hyversa, | |
| 2397 | at a user specified time, prior to reaching the end of the document. | |
| 2398 | This may be accomplished, by invoking the | |
| 2399 | .CW pdfsync | |
| 2400 | macro with an argument, i.e. | |
| 2401 | .QP | |
| 2402 | .fam C | |
| 2403 | .B ".pdfsync M" | |
| 2404 | .LP | |
| 2405 | to flush only the \(lqmeta\(hydata cache\(rq, or | |
| 2406 | .QP | |
| 2407 | .fam C | |
| 2408 | .B ".pdfsync O" | |
| 2409 | .LP | |
| 2410 | to flush only the \(lqoutline cache\(rq. | |
| 2411 | .LP | |
| 2412 | The \(lqmeta\(hydata cache\(rq can normally be safely flushed | |
| 2413 | in this manner, at any time | |
| 2414 | .EM after | |
| 2415 | output of the first page has started; | |
| 2416 | (it may cause formatting problems, | |
| 2417 | most notably the appearance of unwanted white space, if flushed earlier, | |
| 2418 | or indeed, if flushed immediately after a page transition, | |
| 2419 | but before the output of the content on the new page has commenced). | |
| 2420 | Caution is required, however, when explicitly flushing the | |
| 2421 | \(lqoutline cache\(rq, since if the outline is to be | |
| 2422 | subsequently extended, then the first outline entry after flushing | |
| 2423 | .EM must | |
| 2424 | be specified at level 1. | |
| 4d3e9548 | 2425 | Nevertheless, such explicit flushing may occasionally be necessary; |
| 465b256c JR |
2426 | for example, the |
| 2427 | .CW TC | |
| 2428 | macro in the | |
| 2429 | .CW spdf.tmac | |
| 2430 | package, | |
| 2431 | .XR using-spdf ), ( | |
| 2432 | invokes | |
| 2433 | .CW ".pdfsync\ O" \(rq \(lq | |
| 2434 | to ensure that the outline for the \(lqbody\(rq section of the document | |
| 2435 | is terminated, | |
| 2436 | .EM before | |
| 2437 | it commences the formatting of the table of contents section. | |
| 2438 | .bp | |
| 2439 | .NH 1 | |
| 2440 | .XN -N pdf-layout -- PDF Document Layout | |
| 2441 | .LP | |
| 2442 | The | |
| 2443 | .CW pdfmark | |
| 2444 | macros described in the preceding section, | |
| 2445 | .XR pdf-features ), ( | |
| 2446 | provide no inherent document formatting capability of their own. | |
| 2447 | However, | |
| 2448 | they may be used in conjunction with any other | |
| 2449 | .CW groff | |
| 2450 | macro package of the user's choice, | |
| 2451 | to add such capability. | |
| 2452 | .LP | |
| 2453 | In preparing this document, the standard | |
| 2454 | .CW ms | |
| 2455 | macro package, supplied as a component of the GNU Troff distribution, | |
| 2456 | has been employed. | |
| 2457 | To facilitate the use of the | |
| 2458 | .CW pdfmark | |
| 2459 | macros with the | |
| 2460 | .CW ms | |
| 2461 | macros, | |
| 2462 | a binding macro package, | |
| 2463 | .CW spdf.tmac , | |
| 2464 | has been created. | |
| 2465 | The use of this binding macro package is described in the following section, | |
| 2466 | .XR using-spdf ); ( | |
| 2467 | it may also serve as an example to users of other standard | |
| 2468 | .CW groff | |
| 2469 | macro packages, | |
| 2470 | as to how the | |
| 2471 | .CW pdfmark | |
| 2472 | macros may be employed with their chosen primary macro package. | |
| 2473 | .NH 2 | |
| 2474 | .XN -N using-spdf -- Using \F[C]pdfmark\F[] Macros with the \F[C]ms\F[] Macro Package | |
| 2475 | .LP | |
| 2476 | The use of the binding macro package, | |
| 2477 | .CW spdf.tmac , | |
| 2478 | allows for the use of the | |
| 2479 | .CW pdfmark | |
| 2480 | macros in conjunction with the | |
| 2481 | .CW ms | |
| 2482 | macros, | |
| 2483 | simply by issuing a | |
| 2484 | .CW groff | |
| 2485 | command of the form | |
| 2486 | .QP | |
| 2487 | .fam C | |
| 2488 | groff -Tps | |
| 2489 | .B -mspdf | |
| 2490 | .I "-options ...\&" ] [ | |
| 2491 | file(s) ... | |
| 2492 | .LP | |
| 2493 | When using the | |
| 2494 | .CW spdf.tmac | |
| 2495 | package, the | |
| 2496 | .CW groff | |
| 2497 | input files may be marked up using any of the standard | |
| 2498 | .CW ms | |
| 2499 | macros to specify document formatting, | |
| 2500 | while PDF features may be added, | |
| 2501 | using any of the | |
| 2502 | .CW pdfmark | |
| 2503 | macros described previously, | |
| 2504 | .XR pdf-features ). ( | |
| 2505 | Additionally, | |
| 2506 | .CW spdf.tmac | |
| 2507 | defines a number of convenient extensions to the | |
| 2508 | .CW ms | |
| 2509 | macro set, to better accomodate the use of PDF features within the | |
| 2510 | .CW ms | |
| 2511 | formatting framework, | |
| 2512 | and to address a number of | |
| 2513 | .CW ms | |
| 2514 | document layout issues, | |
| 2515 | which require special handling when producing PDF documents. | |
| 2516 | These additional macros, | |
| 2517 | and the issues they are intended to address, | |
| 2518 | are described below. | |
| 2519 | .NH 3 | |
| 2520 | .XN \F[C]ms\F[] Section Headings in PDF Documents | |
| 2521 | .LP | |
| 2522 | Traditionally, | |
| 2523 | .CW ms | |
| 2524 | provides the | |
| 2525 | .CW NH | |
| 2526 | and | |
| 2527 | .CW SH | |
| 2528 | macros, to specify section headings. | |
| 2529 | However, | |
| 2530 | there is no standard mechanism for generating a | |
| 2531 | table of contents entry based on the text of the section heading; | |
| 2532 | neither is there any recognised standard method for establishing a | |
| 2533 | cross reference link to the section. | |
| 2534 | .LP | |
| 2535 | To address this | |
| 2536 | .CW ms | |
| 2537 | limitation, | |
| 2538 | .CW spdf.tmac | |
| 2539 | defines the | |
| 2540 | .CW XN | |
| 2541 | macro, | |
| 2542 | .XR xn-macro ), ( | |
| 2543 | to be used in conjunction with the | |
| 2544 | .CW NH | |
| 2545 | macro. | |
| 2546 | .NH 4 | |
| 2547 | .XN -N xn-macro -- The \F[C]XN\F[] Macro | |
| 2548 | .NH 1 | |
| 2549 | .XN The PDF Publishing Process | |
| 2550 | .NH 2 | |
| 2551 | .XN -N do-xref -- Resolving Cross References | |
| 2552 | .NH 3 | |
| 2553 | .XN -N create-map -- Creating a Document Reference Map | |
| 2554 | .NH 3 | |
| 2555 | .XN -N import-map -- Deploying a Document Reference Map | |
| 2556 | .TC |