Commit f3d68aa5a0b642c8d38ff52f5fef0f7fc036f033

Authored by Jay Berkenbilt
1 parent 7dd5f312

Incorporate editorial changes from m-holger

generate_auto_job
@@ -159,8 +159,11 @@ class Main: @@ -159,8 +159,11 @@ class Main:
159 if long_text == '': 159 if long_text == '':
160 raise Exception(f'missing long text for {topic}') 160 raise Exception(f'missing long text for {topic}')
161 long_text += '\n' 161 long_text += '\n'
162 - for i in re.finditer(r'--help=([^\.\s]+)', long_text):  
163 - self.referenced_topics.add(i.group(1)) 162 + if topic != '--help':
  163 + # Help for --help itself has --help=... not
  164 + # referring to specific options.
  165 + for i in re.finditer(r'--help=([^\.\s]+)', long_text):
  166 + self.referenced_topics.add(i.group(1))
164 return True 167 return True
165 return False 168 return False
166 169
job.sums
1 # Generated by generate_auto_job 1 # Generated by generate_auto_job
2 -generate_auto_job 8efd9e2fa9d517ceb80404f1779f37de194df32a422f0beca30a2b47cc64d816 2 +generate_auto_job bc2f0e8cecebe8b11950cf37714a646fd5a1d294839b748d1c499353226dd642
3 include/qpdf/auto_job_c_att.hh 7ad43bb374c1370ef32ebdcdcb7b73a61d281f7f4e3f12755585872ab30fb60e 3 include/qpdf/auto_job_c_att.hh 7ad43bb374c1370ef32ebdcdcb7b73a61d281f7f4e3f12755585872ab30fb60e
4 include/qpdf/auto_job_c_copy_att.hh 32275d03cdc69b703dd7e02ba0bbe15756e714e9ad185484773a6178dc09e1ee 4 include/qpdf/auto_job_c_copy_att.hh 32275d03cdc69b703dd7e02ba0bbe15756e714e9ad185484773a6178dc09e1ee
5 include/qpdf/auto_job_c_enc.hh 72e138c7b96ed5aacdce78c1dec04b1c20d361faec4f8faf52f64c1d6be99265 5 include/qpdf/auto_job_c_enc.hh 72e138c7b96ed5aacdce78c1dec04b1c20d361faec4f8faf52f64c1d6be99265
@@ -8,8 +8,8 @@ include/qpdf/auto_job_c_pages.hh 931840b329a36ca0e41401190e04537b47f2867671a6643 @@ -8,8 +8,8 @@ include/qpdf/auto_job_c_pages.hh 931840b329a36ca0e41401190e04537b47f2867671a6643
8 include/qpdf/auto_job_c_uo.hh 0585b7de459fa479d9e51a45fa92de0ff6dee748efc9ec1cedd0dde6cee1ad50 8 include/qpdf/auto_job_c_uo.hh 0585b7de459fa479d9e51a45fa92de0ff6dee748efc9ec1cedd0dde6cee1ad50
9 job.yml 1590fd16fd17ed40db9aa56b6713c844cfd61b3a6d0441a3ccd122b7371c68e9 9 job.yml 1590fd16fd17ed40db9aa56b6713c844cfd61b3a6d0441a3ccd122b7371c68e9
10 libqpdf/qpdf/auto_job_decl.hh 9f79396ec459f191be4c5fe34cf88c265cf47355a1a945fa39169d1c94cf04f6 10 libqpdf/qpdf/auto_job_decl.hh 9f79396ec459f191be4c5fe34cf88c265cf47355a1a945fa39169d1c94cf04f6
11 -libqpdf/qpdf/auto_job_help.hh 524e8123152df496794954d16a556d5fee9c76ec6a7f5a6b8f9d2b59c1719e10 11 +libqpdf/qpdf/auto_job_help.hh 05cddfb81ed7fb58a8249b912890e560cb76bd51389d64eae6c662ca552c87d9
12 libqpdf/qpdf/auto_job_init.hh 3b6323189480a7d782563c9d2b5bc29b8dcd19c6dcc89840b207e38cb503d3f1 12 libqpdf/qpdf/auto_job_init.hh 3b6323189480a7d782563c9d2b5bc29b8dcd19c6dcc89840b207e38cb503d3f1
13 libqpdf/qpdf/auto_job_schema.hh 1c3b4b5488270f8d200ed345573e3a241f15baff6fb7e97ec3d044103b2546d9 13 libqpdf/qpdf/auto_job_schema.hh 1c3b4b5488270f8d200ed345573e3a241f15baff6fb7e97ec3d044103b2546d9
14 manual/_ext/qpdf.py e9ac9d6c70642a3d29281ee5ad92ae2422dee8be9306fb8a0bc9dba0ed5e28f3 14 manual/_ext/qpdf.py e9ac9d6c70642a3d29281ee5ad92ae2422dee8be9306fb8a0bc9dba0ed5e28f3
15 -manual/cli.rst 06785f88a28703da0f6d81b6983ae6c09aa1dd8cd958fb5058d56177da431c6c 15 +manual/cli.rst 9aecd2905844fbda5cd528afd7fedef693ac0958bcb20e235f1c8e10a1896abe
libqpdf/qpdf/auto_job_help.hh
@@ -54,8 +54,11 @@ ap.addOptionHelp("--completion-zsh", "completion", "enable zsh completion", R"(O @@ -54,8 +54,11 @@ ap.addOptionHelp("--completion-zsh", "completion", "enable zsh completion", R"(O
54 ap.addHelpTopic("help", "information about qpdf", R"(Help options provide some information about qpdf itself. Help 54 ap.addHelpTopic("help", "information about qpdf", R"(Help options provide some information about qpdf itself. Help
55 options are only valid as the first and only command-line argument. 55 options are only valid as the first and only command-line argument.
56 )"); 56 )");
57 -ap.addOptionHelp("--help", "help", "provide help", R"(Display help information. Run qpdf --help for information about  
58 -how to get help on various topics. 57 +ap.addOptionHelp("--help", "help", "provide help", R"(--help[=--option|topic]
  58 +
  59 +--help: provide general information and a list of topics
  60 +--help=--option: provide help on a specific option
  61 +--help=topic: provide help on a topic
59 )"); 62 )");
60 ap.addOptionHelp("--version", "help", "show qpdf version", R"(Display the version of qpdf. 63 ap.addOptionHelp("--version", "help", "show qpdf version", R"(Display the version of qpdf.
61 )"); 64 )");
@@ -70,7 +73,7 @@ directly related to the operation it is performing. @@ -70,7 +73,7 @@ directly related to the operation it is performing.
70 ap.addOptionHelp("--password", "general", "specify password", R"(--password=password 73 ap.addOptionHelp("--password", "general", "specify password", R"(--password=password
71 74
72 Specify a password for an encrypted, password-protected file. 75 Specify a password for an encrypted, password-protected file.
73 -Not needed for encrypted files with no password. 76 +Not needed for encrypted files without a password.
74 )"); 77 )");
75 ap.addOptionHelp("--password-file", "general", "read password from a file", R"(--password-file=filename 78 ap.addOptionHelp("--password-file", "general", "read password from a file", R"(--password-file=filename
76 79
@@ -119,9 +122,9 @@ ap.addOptionHelp("--password-is-hex-key", "advanced-control", "provide hex-encod @@ -119,9 +122,9 @@ ap.addOptionHelp("--password-is-hex-key", "advanced-control", "provide hex-encod
119 string rather than supplying a password. This is an expert 122 string rather than supplying a password. This is an expert
120 option. 123 option.
121 )"); 124 )");
122 -ap.addOptionHelp("--suppress-password-recovery", "advanced-control", "don't try different password encodings", R"(Suppress qpdf's behavior of attempting different encodings of a  
123 -password that contains non-ASCII Unicode characters if the first  
124 -attempt doesn't succeed. 125 +ap.addOptionHelp("--suppress-password-recovery", "advanced-control", "don't try different password encodings", R"(Suppress qpdf's usual behavior of attempting different encodings
  126 +of a password that contains non-ASCII Unicode characters if the
  127 +first attempt doesn't succeed.
125 )"); 128 )");
126 ap.addOptionHelp("--password-mode", "advanced-control", "tweak how qpdf encodes passwords", R"(--password-mode=mode 129 ap.addOptionHelp("--password-mode", "advanced-control", "tweak how qpdf encodes passwords", R"(--password-mode=mode
127 130
@@ -139,7 +142,7 @@ the structure without changing the content. @@ -139,7 +142,7 @@ the structure without changing the content.
139 )"); 142 )");
140 ap.addOptionHelp("--linearize", "transformation", "linearize (web-optimize) output", R"(Create linearized (web-optimized) output files. 143 ap.addOptionHelp("--linearize", "transformation", "linearize (web-optimize) output", R"(Create linearized (web-optimized) output files.
141 )"); 144 )");
142 -ap.addOptionHelp("--encrypt", "transformation", "start encryption options", R"(--encrypt user-password owner-password key-length [ options ] -- 145 +ap.addOptionHelp("--encrypt", "transformation", "start encryption options", R"(--encrypt user-password owner-password key-length [options] --
143 146
144 Run qpdf --help=encryption for details. 147 Run qpdf --help=encryption for details.
145 )"); 148 )");
@@ -159,12 +162,12 @@ If the file named in --copy-encryption requires a password, use @@ -159,12 +162,12 @@ If the file named in --copy-encryption requires a password, use
159 this option to supply the password. 162 this option to supply the password.
160 )"); 163 )");
161 ap.addOptionHelp("--qdf", "transformation", "enable viewing PDF code in a text editor", R"(Create a PDF file suitable for viewing in a text editor and even 164 ap.addOptionHelp("--qdf", "transformation", "enable viewing PDF code in a text editor", R"(Create a PDF file suitable for viewing in a text editor and even
162 -editing. This is to edit the PDF code, not the page contents. 165 +editing. This is for editing the PDF code, not the page contents.
163 All streams that can be uncompressed are uncompressed, and 166 All streams that can be uncompressed are uncompressed, and
164 content streams are normalized, among other changes. The 167 content streams are normalized, among other changes. The
165 companion tool "fix-qdf" can be used to repair hand-edited QDF 168 companion tool "fix-qdf" can be used to repair hand-edited QDF
166 -files. QDF is a feature specific to the qpdf tool. There is a  
167 -chapter about it in the manual. 169 +files. QDF is a feature specific to the qpdf tool. Please see
  170 +the "QDF Mode" chapter in the manual.
168 )"); 171 )");
169 ap.addOptionHelp("--no-original-object-ids", "transformation", "omit original object IDs in qdf", R"(Omit comments in a QDF file indicating the object ID an object 172 ap.addOptionHelp("--no-original-object-ids", "transformation", "omit original object IDs in qdf", R"(Omit comments in a QDF file indicating the object ID an object
170 had in the original file. 173 had in the original file.
@@ -256,8 +259,11 @@ default is 1,024. Use 0 for no minimum. @@ -256,8 +259,11 @@ default is 1,024. Use 0 for no minimum.
256 )"); 259 )");
257 ap.addOptionHelp("--min-version", "transformation", "set minimum PDF version", R"(--min-version=version 260 ap.addOptionHelp("--min-version", "transformation", "set minimum PDF version", R"(--min-version=version
258 261
259 -Force the PDF version of the output to be at least the  
260 -specified version. 262 +Force the PDF version of the output to be at least the specified
  263 +version. The version number format is
  264 +"major.minor[.extension-level]", which sets the version header
  265 +to "major.minor" and the extension level, if specified, to
  266 +"extension-level".
261 )"); 267 )");
262 ap.addOptionHelp("--force-version", "transformation", "set output PDF version", R"(--force-version=version 268 ap.addOptionHelp("--force-version", "transformation", "set output PDF version", R"(--force-version=version
263 269
@@ -281,7 +287,7 @@ from the resulting set, not based on the original page numbers. @@ -281,7 +287,7 @@ from the resulting set, not based on the original page numbers.
281 ap.addHelpTopic("modification", "change parts of the PDF", R"(Modification options make systematic changes to certain parts of 287 ap.addHelpTopic("modification", "change parts of the PDF", R"(Modification options make systematic changes to certain parts of
282 the PDF, causing the PDF to render differently from the original. 288 the PDF, causing the PDF to render differently from the original.
283 )"); 289 )");
284 -ap.addOptionHelp("--pages", "modification", "begin page selection", R"(--pages file [ --password=password ] [ page-range ] [ ... ] -- 290 +ap.addOptionHelp("--pages", "modification", "begin page selection", R"(--pages file [--password=password] [page-range] [...] --
285 291
286 Run qpdf --help=page-selection for details. 292 Run qpdf --help=page-selection for details.
287 )"); 293 )");
@@ -312,12 +318,12 @@ File names are generated from the specified output file as follows: @@ -312,12 +318,12 @@ File names are generated from the specified output file as follows:
312 Page ranges are single page numbers for single-page groups or first-last 318 Page ranges are single page numbers for single-page groups or first-last
313 for multi-page groups. 319 for multi-page groups.
314 )"); 320 )");
315 -ap.addOptionHelp("--overlay", "modification", "begin overlay options", R"(--overlay file [ options ] -- 321 +ap.addOptionHelp("--overlay", "modification", "begin overlay options", R"(--overlay file [options] --
316 322
317 Overlay pages from another file on the output. 323 Overlay pages from another file on the output.
318 Run qpdf --help=overlay-underlay for details. 324 Run qpdf --help=overlay-underlay for details.
319 )"); 325 )");
320 -ap.addOptionHelp("--underlay", "modification", "begin underlay options", R"(--underlay file [ options ] -- 326 +ap.addOptionHelp("--underlay", "modification", "begin underlay options", R"(--underlay file [options] --
321 327
322 Underlay pages from another file on the output. 328 Underlay pages from another file on the output.
323 Run qpdf --help=overlay-underlay for details. 329 Run qpdf --help=overlay-underlay for details.
@@ -375,7 +381,7 @@ ap.addOptionHelp("--remove-page-labels", "modification", "remove explicit page n @@ -375,7 +381,7 @@ ap.addOptionHelp("--remove-page-labels", "modification", "remove explicit page n
375 )"); 381 )");
376 ap.addHelpTopic("encryption", "create encrypted files", R"(Create encrypted files. Usage: 382 ap.addHelpTopic("encryption", "create encrypted files", R"(Create encrypted files. Usage:
377 383
378 ---encrypt user-password owner-password key-length [ options ] -- 384 +--encrypt user-password owner-password key-length [options] --
379 385
380 Either or both of user-password and owner-password may be empty 386 Either or both of user-password and owner-password may be empty
381 strings. key-length may be 40, 128, or 256. Encryption options are 387 strings. key-length may be 40, 128, or 256. Encryption options are
@@ -523,13 +529,13 @@ should not be used except for compatibility testing. @@ -523,13 +529,13 @@ should not be used except for compatibility testing.
523 )"); 529 )");
524 ap.addHelpTopic("page-selection", "select pages from one or more files", R"(Use the --pages option to select pages from multiple files. Usage: 530 ap.addHelpTopic("page-selection", "select pages from one or more files", R"(Use the --pages option to select pages from multiple files. Usage:
525 531
526 -qpdf in.pdf --pages input-file [ --password=password ] [ page-range ] \  
527 - [ ... ] -- out.pdf 532 +qpdf in.pdf --pages input-file [--password=password] [page-range] \
  533 + [...] -- out.pdf
528 534
529 Between --pages and the -- that terminates pages option, repeat 535 Between --pages and the -- that terminates pages option, repeat
530 the following: 536 the following:
531 537
532 -filename [ --password=password ] [ page-range ] 538 +filename [--password=password] [page-range]
533 539
534 Document-level information, such as outlines, tags, etc., is taken 540 Document-level information, such as outlines, tags, etc., is taken
535 from in.pdf and is preserved in out.pdf. You can use --empty in place 541 from in.pdf and is preserved in out.pdf. You can use --empty in place
@@ -571,10 +577,10 @@ the destination page and may obscure the page. Underlaid pages are @@ -571,10 +577,10 @@ the destination page and may obscure the page. Underlaid pages are
571 drawn below the destination page. Usage: 577 drawn below the destination page. Usage:
572 578
573 {--overlay | --underlay } file 579 {--overlay | --underlay } file
574 - [ --password=password ]  
575 - [ --to=page-range ]  
576 - [ --from=[page-range] ]  
577 - [ --repeat=page-range ] 580 + [--password=password]
  581 + [--to=page-range]
  582 + [--from=[page-range]]
  583 + [--repeat=page-range]
578 -- 584 --
579 585
580 Note the use of "--" by itself to terminate overlay/underlay options. 586 Note the use of "--" by itself to terminate overlay/underlay options.
manual/cli.rst
@@ -84,7 +84,7 @@ Basic Invocation @@ -84,7 +84,7 @@ Basic Invocation
84 84
85 :: 85 ::
86 86
87 - Usage: qpdf infile [ options ] [ outfile ] 87 + Usage: qpdf infile [options] [outfile]
88 88
89 The :command:`qpdf` command reads the PDF file :samp:`{infile}`, 89 The :command:`qpdf` command reads the PDF file :samp:`{infile}`,
90 applies various transformations or modifications to the file in 90 applies various transformations or modifications to the file in
@@ -294,14 +294,17 @@ are only valid as the first and only command-line argument. @@ -294,14 +294,17 @@ are only valid as the first and only command-line argument.
294 Related Options 294 Related Options
295 ~~~~~~~~~~~~~~~ 295 ~~~~~~~~~~~~~~~
296 296
297 -.. qpdf:option:: --help 297 +.. qpdf:option:: --help[=--option|topic]
298 298
299 .. help: provide help 299 .. help: provide help
300 300
301 - Display help information. Run qpdf --help for information about  
302 - how to get help on various topics. 301 + --help: provide general information and a list of topics
  302 + --help=--option: provide help on a specific option
  303 + --help=topic: provide help on a topic
303 304
304 - Display command-line invocation help. 305 + Display command-line invocation help. Use :samp:`--help={--option}`
  306 + for help on a specific option and :samp:`--help={topic}` for help
  307 + on a help topic and also provides a list of available help topics.
305 308
306 .. qpdf:option:: --version 309 .. qpdf:option:: --version
307 310
@@ -357,7 +360,7 @@ Related Options @@ -357,7 +360,7 @@ Related Options
357 .. help: specify password 360 .. help: specify password
358 361
359 Specify a password for an encrypted, password-protected file. 362 Specify a password for an encrypted, password-protected file.
360 - Not needed for encrypted files with no password. 363 + Not needed for encrypted files without a password.
361 364
362 Specifies a password for accessing encrypted, password-protected 365 Specifies a password for accessing encrypted, password-protected
363 files. To read the password from a file or standard input, you can 366 files. To read the password from a file or standard input, you can
@@ -385,7 +388,8 @@ Related Options @@ -385,7 +388,8 @@ Related Options
385 password for accessing encrypted files. :samp:`{filename}` may be 388 password for accessing encrypted files. :samp:`{filename}` may be
386 ``-`` to read the password from standard input, but if you do that 389 ``-`` to read the password from standard input, but if you do that
387 the password is echoed and there is no prompt, so use ``-`` with 390 the password is echoed and there is no prompt, so use ``-`` with
388 - caution. 391 + caution. Note that leading and trailing spaces are not stripped
  392 + from the password.
389 393
390 .. qpdf:option:: --verbose 394 .. qpdf:option:: --verbose
391 395
@@ -407,9 +411,9 @@ Related Options @@ -407,9 +411,9 @@ Related Options
407 Indicate progress when writing files. 411 Indicate progress when writing files.
408 412
409 Indicate progress while writing output files. Progress indication 413 Indicate progress while writing output files. Progress indication
410 - does not start until writing starts, so if complicated  
411 - transformations are being applied before the write process begins,  
412 - there may be a delay before progress indicators are seen. 414 + does not start until writing starts, so there may be a delay before
  415 + progress indicators are seen if complicated transformations are
  416 + being applied before the write process begins.
413 417
414 .. qpdf:option:: --no-warn 418 .. qpdf:option:: --no-warn
415 419
@@ -435,23 +439,25 @@ Related Options @@ -435,23 +439,25 @@ Related Options
435 information, such as the page contents. Does not use the file's 439 information, such as the page contents. Does not use the file's
436 name or attributes or the current time. 440 name or attributes or the current time.
437 441
438 - Generate of a secure, random document ID using deterministic  
439 - values. This prevents use of timestamp and output file name  
440 - information in the ID generation. Instead, at some slight  
441 - additional runtime cost, the ID field is generated to include a  
442 - digest of the significant parts of the content of the output PDF  
443 - file. This means that a given qpdf operation should generate the  
444 - same ID each time it is run, which can be useful when caching  
445 - results or for generation of some test data. Use of this flag is  
446 - not compatible with creation of encrypted files.  
447 -  
448 - Note that there is *no guarantee* that different versions of qpdf  
449 - will generate the same deterministic ID given the same generation  
450 - code and input. While care is taken to avoid gratuitous changes,  
451 - new versions of qpdf may include changes that affect the output.  
452 - This option can be useful for testing. See also 442 + Generate a secure, random document ID using deterministic values.
  443 + This prevents use of timestamp and output file name information in
  444 + the ID generation. Instead, at some slight additional runtime cost,
  445 + the ID field is generated to include a digest of the significant
  446 + parts of the content of the output PDF file. This means that a
  447 + given qpdf operation should generate the same ID each time it is
  448 + run, which can be useful when caching results or for generation of
  449 + some test data. Use of this flag is not compatible with creation of
  450 + encrypted files. This option can be useful for testing. See also
453 :qpdf:ref:`--static-id`. 451 :qpdf:ref:`--static-id`.
454 452
  453 + While qpdf will generate the same deterministic ID given the same
  454 + output PDF, there is no guarantee that different versions of qpdf
  455 + will generate exactly the same PDF output for the same input and
  456 + options. While care is taken to avoid gratuitous changes to qpdf's
  457 + PDF generation, new versions of qpdf may include changes or bug
  458 + fixes that cause slightly different PDF code to be generated. Such
  459 + changes are noted in the release notes.
  460 +
455 .. qpdf:option:: --allow-weak-crypto 461 .. qpdf:option:: --allow-weak-crypto
456 462
457 .. help: allow insecure cryptographic algorithms 463 .. help: allow insecure cryptographic algorithms
@@ -561,9 +567,9 @@ Related Options @@ -561,9 +567,9 @@ Related Options
561 567
562 .. help: don't try different password encodings 568 .. help: don't try different password encodings
563 569
564 - Suppress qpdf's behavior of attempting different encodings of a  
565 - password that contains non-ASCII Unicode characters if the first  
566 - attempt doesn't succeed. 570 + Suppress qpdf's usual behavior of attempting different encodings
  571 + of a password that contains non-ASCII Unicode characters if the
  572 + first attempt doesn't succeed.
567 573
568 Ordinarily, qpdf attempts to automatically compensate for passwords 574 Ordinarily, qpdf attempts to automatically compensate for passwords
569 encoded with the wrong character encoding. This option suppresses 575 encoded with the wrong character encoding. This option suppresses
@@ -666,8 +672,8 @@ The options discussed in this section tell qpdf to apply @@ -666,8 +672,8 @@ The options discussed in this section tell qpdf to apply
666 transformations that change the structure of a PDF file without 672 transformations that change the structure of a PDF file without
667 changing its content. Examples include creating linearized 673 changing its content. Examples include creating linearized
668 (web-optimized) files, adding or removing encryption, restructuring 674 (web-optimized) files, adding or removing encryption, restructuring
669 -files for older viewers, and rewriting files for human inspection,  
670 -among others. See also :ref:`modification-options`. 675 +files for older viewers, and rewriting files for human inspection. See
  676 +also :ref:`modification-options`.
671 677
672 Related Options 678 Related Options
673 ~~~~~~~~~~~~~~~ 679 ~~~~~~~~~~~~~~~
@@ -685,17 +691,14 @@ Related Options @@ -685,17 +691,14 @@ Related Options
685 important cross-reference information typically appears at the end 691 important cross-reference information typically appears at the end
686 of the file. 692 of the file.
687 693
688 -.. qpdf:option:: --encrypt user-password owner-password key-length [ options ] -- 694 +.. qpdf:option:: --encrypt user-password owner-password key-length [options] --
689 695
690 .. help: start encryption options 696 .. help: start encryption options
691 697
692 Run qpdf --help=encryption for details. 698 Run qpdf --help=encryption for details.
693 699
694 This flag starts encryption options, used to create encrypted 700 This flag starts encryption options, used to create encrypted
695 - files.  
696 -  
697 - Please see :ref:`encryption-options` for details about creating  
698 - encrypted files. 701 + files. Please see :ref:`encryption-options` for details.
699 702
700 .. qpdf:option:: --decrypt 703 .. qpdf:option:: --decrypt
701 704
@@ -720,19 +723,19 @@ Related Options @@ -720,19 +723,19 @@ Related Options
720 preserving the input file's encryption. Use --encryption-file-password 723 preserving the input file's encryption. Use --encryption-file-password
721 to specify the encryption file's password. 724 to specify the encryption file's password.
722 725
723 - Copy encryption parameters, including the user password, the owner  
724 - password, and all security restrictions, from the specified file  
725 - instead of preserving encryption details from the input file. This  
726 - works even if only one of the user password or owner password is  
727 - known. If the encryption file requires a password, use the  
728 - :qpdf:ref:`--encryption-file-password` option to set it. Note that  
729 - copying the encryption parameters from a file also copies the first  
730 - half of ``/ID`` from the file since this is part of the encryption  
731 - parameters. This option can be useful if you need to decrypt a file  
732 - to make manual changes to it or to change it outside of qpdf, and  
733 - then want to restore the original encryption on the file  
734 - without having to manual specify all the individual settings. See  
735 - also :qpdf:ref:`--decrypt`. 726 + Copy all encryption parameters, including the user password, the
  727 + owner password, and all security restrictions, from the specified
  728 + file instead of preserving the encryption details from the input
  729 + file. This works even if only one of the user password or owner
  730 + password is known. If the encryption file requires a password, use
  731 + the :qpdf:ref:`--encryption-file-password` option to set it. Note
  732 + that copying the encryption parameters from a file also copies the
  733 + first half of ``/ID`` from the file since this is part of the
  734 + encryption parameters. This option can be useful if you need to
  735 + decrypt a file to make manual changes to it or to change it outside
  736 + of qpdf, and then want to restore the original encryption on the
  737 + file without having to manual specify all the individual settings.
  738 + See also :qpdf:ref:`--decrypt`.
736 739
737 .. qpdf:option:: --encryption-file-password=password 740 .. qpdf:option:: --encryption-file-password=password
738 741
@@ -752,12 +755,12 @@ Related Options @@ -752,12 +755,12 @@ Related Options
752 .. help: enable viewing PDF code in a text editor 755 .. help: enable viewing PDF code in a text editor
753 756
754 Create a PDF file suitable for viewing in a text editor and even 757 Create a PDF file suitable for viewing in a text editor and even
755 - editing. This is to edit the PDF code, not the page contents. 758 + editing. This is for editing the PDF code, not the page contents.
756 All streams that can be uncompressed are uncompressed, and 759 All streams that can be uncompressed are uncompressed, and
757 content streams are normalized, among other changes. The 760 content streams are normalized, among other changes. The
758 companion tool "fix-qdf" can be used to repair hand-edited QDF 761 companion tool "fix-qdf" can be used to repair hand-edited QDF
759 - files. QDF is a feature specific to the qpdf tool. There is a  
760 - chapter about it in the manual. 762 + files. QDF is a feature specific to the qpdf tool. Please see
  763 + the "QDF Mode" chapter in the manual.
761 764
762 Create a PDF file suitable for viewing and editing in a text 765 Create a PDF file suitable for viewing and editing in a text
763 editor. This is to edit the PDF code, not the page contents. To 766 editor. This is to edit the PDF code, not the page contents. To
@@ -766,13 +769,13 @@ Related Options @@ -766,13 +769,13 @@ Related Options
766 and content streams are normalized, among other changes. The 769 and content streams are normalized, among other changes. The
767 companion tool :command:`fix-qdf` can be used to repair hand-edited 770 companion tool :command:`fix-qdf` can be used to repair hand-edited
768 QDF files. QDF is a feature specific to the qpdf tool. For 771 QDF files. QDF is a feature specific to the qpdf tool. For
769 - additional information about QDF mode, see :ref:`qdf`. Note that 772 + additional information, see :ref:`qdf`. Note that
770 :qpdf:ref:`--linearize` disables QDF mode. 773 :qpdf:ref:`--linearize` disables QDF mode.
771 774
772 QDF mode has full support for object streams, but sometimes it's 775 QDF mode has full support for object streams, but sometimes it's
773 easier to locate a specific object if object streams are disabled. 776 easier to locate a specific object if object streams are disabled.
774 When trying to understand some PDF construct by inspecting an 777 When trying to understand some PDF construct by inspecting an
775 - existing file, it can often be useful to combine :samp:`--qdf` with 778 + existing file, it can be useful to combine :samp:`--qdf` with
776 :samp:`--object-streams=disable`. 779 :samp:`--object-streams=disable`.
777 780
778 This flag changes some of the defaults of other options: stream 781 This flag changes some of the defaults of other options: stream
@@ -788,10 +791,10 @@ Related Options @@ -788,10 +791,10 @@ Related Options
788 791
789 When normalizing content, if qpdf runs into any lexical errors, it 792 When normalizing content, if qpdf runs into any lexical errors, it
790 will print a warning indicating that content may be damaged. If you 793 will print a warning indicating that content may be damaged. If you
791 - want to create QDF files without content normalization, can you run  
792 - with :samp:`--qdf --normalize-content=n`. You can also create a  
793 - non-QDF file with uncompressed streams using  
794 - :samp:`--stream-data=uncompress`. These will both uncompress all 794 + want to create QDF files without content normalization, specify
  795 + :samp:`--qdf --normalize-content=n`. You can also create a non-QDF
  796 + file with uncompressed streams using
  797 + :samp:`--stream-data=uncompress`. Either option will uncompress all
795 the streams but will not attempt to normalize content. Please note 798 the streams but will not attempt to normalize content. Please note
796 that if you are using content normalization or QDF mode for the 799 that if you are using content normalization or QDF mode for the
797 purpose of manually inspecting files, you don't have to care about 800 purpose of manually inspecting files, you don't have to care about
@@ -872,15 +875,15 @@ Related Options @@ -872,15 +875,15 @@ Related Options
872 These are left untouched regardless of the option. Future versions 875 These are left untouched regardless of the option. Future versions
873 of qpdf may support additional filters. 876 of qpdf may support additional filters.
874 877
875 - Because the default value is ``generalized``, by default, when a stream  
876 - is encoded using non-lossy filters that qpdf understands and is not  
877 - already compressed using a good compression scheme, qpdf will  
878 - uncompress the stream. If ``--compress-streams=y`` is also in  
879 - effect, which is the default (see :qpdf:ref:`--compress-streams`),  
880 - the overall effect is that qpdf will recompress streams with  
881 - generalized filters using flate compression, effectively  
882 - eliminating LZW and ASCII-based filters. This is usually desirable  
883 - behavior but can be disabled with ``--decode-level=none``. 878 + Because the default value is ``generalized``, qpdf's default
  879 + behavior is to uncompress any stream that is encoded using
  880 + non-lossy filters that qpdf understands. If
  881 + ``--compress-streams=y`` is also in effect, which is the default
  882 + (see :qpdf:ref:`--compress-streams`), the overall effect is that
  883 + qpdf will recompress streams with generalized filters using flate
  884 + compression, effectively eliminating LZW and ASCII-based filters.
  885 + This is usually desirable behavior but can be disabled with
  886 + ``--decode-level=none``.
884 887
885 As a special case, streams already compressed with ``/FlateDecode`` 888 As a special case, streams already compressed with ``/FlateDecode``
886 are not uncompressed and recompressed. You can change this behavior 889 are not uncompressed and recompressed. You can change this behavior
@@ -956,7 +959,8 @@ Related Options @@ -956,7 +959,8 @@ Related Options
956 already compressed streams, you should also specify 959 already compressed streams, you should also specify
957 :qpdf:ref:`--recompress-flate`. If your goal is to shrink the size 960 :qpdf:ref:`--recompress-flate`. If your goal is to shrink the size
958 of PDF files, you should also use 961 of PDF files, you should also use
959 - :samp:`--object-streams=generate`. 962 + :samp:`--object-streams=generate`. If you omit this option, qpdf
  963 + defers to the compression library's default behavior.
960 964
961 .. qpdf:option:: --normalize-content=[yn] 965 .. qpdf:option:: --normalize-content=[yn]
962 966
@@ -1002,10 +1006,10 @@ Related Options @@ -1002,10 +1006,10 @@ Related Options
1002 - create object streams, and compress objects when possible 1006 - create object streams, and compress objects when possible
1003 1007
1004 Object streams are PDF streams that contain other objects. Putting 1008 Object streams are PDF streams that contain other objects. Putting
1005 - objects in object streams allows the PDF objects themselves to be 1009 + objects into object streams allows the PDF objects themselves to be
1006 compressed, which can result in much smaller PDF files. Combining 1010 compressed, which can result in much smaller PDF files. Combining
1007 this option with :qpdf:ref:`--compression-level` and 1011 this option with :qpdf:ref:`--compression-level` and
1008 - :qpdf:ref:`--recompress-flate` can often result in creation of 1012 + :qpdf:ref:`--recompress-flate` can often result in the creation of
1009 smaller PDF files. 1013 smaller PDF files.
1010 1014
1011 Object streams, also known as compressed objects, were introduced 1015 Object streams, also known as compressed objects, were introduced
@@ -1014,7 +1018,7 @@ Related Options @@ -1014,7 +1018,7 @@ Related Options
1014 used to transform files with object streams into files without object 1018 used to transform files with object streams into files without object
1015 streams or vice versa. 1019 streams or vice versa.
1016 1020
1017 - In :samp:`preserve` mode, the relationship to objects and the 1021 + In :samp:`preserve` mode, the relationship between objects and the
1018 streams that contain them is preserved from the original file. If 1022 streams that contain them is preserved from the original file. If
1019 the file has no object streams, qpdf will not add any. In 1023 the file has no object streams, qpdf will not add any. In
1020 :samp:`disable` mode, all objects are written as regular, 1024 :samp:`disable` mode, all objects are written as regular,
@@ -1040,7 +1044,7 @@ Related Options @@ -1040,7 +1044,7 @@ Related Options
1040 objects. 1044 objects.
1041 1045
1042 This flag is ignored for linearized files and has the effect of 1046 This flag is ignored for linearized files and has the effect of
1043 - causing objects in the new file to be written in order by object ID 1047 + causing objects in the new file to be written ordered by object ID
1044 from the original file. This does not mean that object numbers will 1048 from the original file. This does not mean that object numbers will
1045 be the same since qpdf may create stream lengths as direct or 1049 be the same since qpdf may create stream lengths as direct or
1046 indirect differently from the original file, and the original file 1050 indirect differently from the original file, and the original file
@@ -1157,8 +1161,11 @@ Related Options @@ -1157,8 +1161,11 @@ Related Options
1157 1161
1158 .. help: set minimum PDF version 1162 .. help: set minimum PDF version
1159 1163
1160 - Force the PDF version of the output to be at least the  
1161 - specified version. 1164 + Force the PDF version of the output to be at least the specified
  1165 + version. The version number format is
  1166 + "major.minor[.extension-level]", which sets the version header
  1167 + to "major.minor" and the extension level, if specified, to
  1168 + "extension-level".
1162 1169
1163 Force the PDF version of the output file to be at least 1170 Force the PDF version of the output file to be at least
1164 :samp:`{version}`. In other words, if the input file has a lower 1171 :samp:`{version}`. In other words, if the input file has a lower
@@ -1169,12 +1176,13 @@ Related Options @@ -1169,12 +1176,13 @@ Related Options
1169 when adding features that require newer PDF readers. 1176 when adding features that require newer PDF readers.
1170 1177
1171 The version number may be expressed in the form 1178 The version number may be expressed in the form
1172 - :samp:`{major.minor.extension-level}`, in which case the version is  
1173 - interpreted as :samp:`{major.minor}` at extension level  
1174 - :samp:`{extension-level}`. For example, version ``1.7.8``  
1175 - represents version 1.7 at extension level 8. Note that minimal  
1176 - syntax checking is done on the command line. :command:`qpdf` does  
1177 - not check whether the specified version is actually required. 1179 + :samp:`{major}.{minor}[.{extension-level}]`. If
  1180 + :samp:`.{extension-level}`, is given, version is interpreted as
  1181 + :samp:`{major.minor}` at extension level :samp:`{extension-level}`.
  1182 + For example, version ``1.7.8`` represents version 1.7 at extension
  1183 + level 8. Note that minimal syntax checking is done on the command
  1184 + line. :command:`qpdf` does not check whether the specified version
  1185 + is actually required.
1178 1186
1179 .. qpdf:option:: --force-version=version 1187 .. qpdf:option:: --force-version=version
1180 1188
@@ -1192,22 +1200,22 @@ Related Options @@ -1192,22 +1200,22 @@ Related Options
1192 version to be lower than that of the input file will cause qpdf to 1200 version to be lower than that of the input file will cause qpdf to
1193 disable certain features of the document. Specifically, 256-bit 1201 disable certain features of the document. Specifically, 256-bit
1194 keys are disabled if the version is less than 1.7 with extension 1202 keys are disabled if the version is less than 1.7 with extension
1195 - level 8 (except R5 is disabled if less than 1.7 with extension  
1196 - level 3), AES encryption is disabled if the version is less than  
1197 - 1.6, cleartext metadata and object streams are disabled if less  
1198 - than 1.5, 128-bit encryption keys are disabled if less than 1.4,  
1199 - and all encryption is disabled if less than 1.3. Even with these  
1200 - precautions, qpdf won't be able to do things like eliminate use of  
1201 - newer image compression schemes, transparency groups, or other  
1202 - features that may have been added in more recent versions of PDF. 1203 + level 8 (except the deprecated, unsupported "R5" format is allowed
  1204 + with extension levels 3 through 7), AES encryption is disabled if
  1205 + the version is less than 1.6, cleartext metadata and object streams
  1206 + are disabled if less than 1.5, 128-bit encryption keys are disabled
  1207 + if less than 1.4, and all encryption is disabled if less than 1.3.
  1208 + Even with these precautions, qpdf won't be able to do things like
  1209 + eliminate use of newer image compression schemes, transparency
  1210 + groups, or other features that may have been added in more recent
  1211 + versions of PDF.
1203 1212
1204 As a general rule, with the exception of big structural things like 1213 As a general rule, with the exception of big structural things like
1205 the use of object streams or AES encryption, PDF viewers are 1214 the use of object streams or AES encryption, PDF viewers are
1206 - supposed to ignore features in files that they don't support from  
1207 - newer versions. This means that forcing the version to a lower  
1208 - version may make it possible to open your PDF file with an older  
1209 - version, though bear in mind that some of the original document's  
1210 - functionality may be lost. 1215 + supposed to ignore features they don't support. This means that
  1216 + forcing the version to a lower version may make it possible to open
  1217 + your PDF file with an older version, though bear in mind that some
  1218 + of the original document's functionality may be lost.
1211 1219
1212 .. _page-ranges: 1220 .. _page-ranges:
1213 1221
@@ -1310,7 +1318,7 @@ PDF, causing the PDF to render differently from the original. See also @@ -1310,7 +1318,7 @@ PDF, causing the PDF to render differently from the original. See also
1310 Related Options 1318 Related Options
1311 ~~~~~~~~~~~~~~~ 1319 ~~~~~~~~~~~~~~~
1312 1320
1313 -.. qpdf:option:: --pages file [ --password=password ] [ page-range ] [ ... ] -- 1321 +.. qpdf:option:: --pages file [--password=password] [page-range] [...] --
1314 1322
1315 .. help: begin page selection 1323 .. help: begin page selection
1316 1324
@@ -1405,7 +1413,7 @@ Related Options @@ -1405,7 +1413,7 @@ Related Options
1405 if you don't require the document-level data. A future version of 1413 if you don't require the document-level data. A future version of
1406 qpdf may support preservation of some document-level information. 1414 qpdf may support preservation of some document-level information.
1407 1415
1408 -.. qpdf:option:: --overlay file [ options ] -- 1416 +.. qpdf:option:: --overlay file [options] --
1409 1417
1410 .. help: begin overlay options 1418 .. help: begin overlay options
1411 1419
@@ -1416,7 +1424,7 @@ Related Options @@ -1416,7 +1424,7 @@ Related Options
1416 1424
1417 See :ref:`overlay-underlay` for details. 1425 See :ref:`overlay-underlay` for details.
1418 1426
1419 -.. qpdf:option:: --underlay file [ options ] -- 1427 +.. qpdf:option:: --underlay file [options] --
1420 1428
1421 .. help: begin underlay options 1429 .. help: begin underlay options
1422 1430
@@ -1674,7 +1682,7 @@ Encryption @@ -1674,7 +1682,7 @@ Encryption
1674 1682
1675 Create encrypted files. Usage: 1683 Create encrypted files. Usage:
1676 1684
1677 - --encrypt user-password owner-password key-length [ options ] -- 1685 + --encrypt user-password owner-password key-length [options] --
1678 1686
1679 Either or both of user-password and owner-password may be empty 1687 Either or both of user-password and owner-password may be empty
1680 strings. key-length may be 40, 128, or 256. Encryption options are 1688 strings. key-length may be 40, 128, or 256. Encryption options are
@@ -1741,7 +1749,7 @@ To create an encrypted file, use @@ -1741,7 +1749,7 @@ To create an encrypted file, use
1741 1749
1742 :: 1750 ::
1743 1751
1744 - --encrypt user-password owner-password key-length [ options ] -- 1752 + --encrypt user-password owner-password key-length [options] --
1745 1753
1746 Either or both of :samp:`{user-password}` and :samp:`{owner-password}` 1754 Either or both of :samp:`{user-password}` and :samp:`{owner-password}`
1747 may be empty strings. :samp:`{key-length}` may be ``40``, ``128``, or 1755 may be empty strings. :samp:`{key-length}` may be ``40``, ``128``, or
@@ -1780,7 +1788,6 @@ encryption from the file entirely. @@ -1780,7 +1788,6 @@ encryption from the file entirely.
1780 Here is a summary of encryption options. Details are provided in the 1788 Here is a summary of encryption options. Details are provided in the
1781 help for each option. 1789 help for each option.
1782 1790
1783 -  
1784 .. list-table:: Options for 40-bit Encryption Only 1791 .. list-table:: Options for 40-bit Encryption Only
1785 :widths: 30 70 1792 :widths: 30 70
1786 :header-rows: 0 1793 :header-rows: 0
@@ -2154,13 +2161,13 @@ Page Selection @@ -2154,13 +2161,13 @@ Page Selection
2154 2161
2155 Use the --pages option to select pages from multiple files. Usage: 2162 Use the --pages option to select pages from multiple files. Usage:
2156 2163
2157 - qpdf in.pdf --pages input-file [ --password=password ] [ page-range ] \  
2158 - [ ... ] -- out.pdf 2164 + qpdf in.pdf --pages input-file [--password=password] [page-range] \
  2165 + [...] -- out.pdf
2159 2166
2160 Between --pages and the -- that terminates pages option, repeat 2167 Between --pages and the -- that terminates pages option, repeat
2161 the following: 2168 the following:
2162 2169
2163 - filename [ --password=password ] [ page-range ] 2170 + filename [--password=password] [page-range]
2164 2171
2165 Document-level information, such as outlines, tags, etc., is taken 2172 Document-level information, such as outlines, tags, etc., is taken
2166 from in.pdf and is preserved in out.pdf. You can use --empty in place 2173 from in.pdf and is preserved in out.pdf. You can use --empty in place
@@ -2200,12 +2207,12 @@ Page Selection @@ -2200,12 +2207,12 @@ Page Selection
2200 split and merge PDF files by selecting pages from one or more input 2207 split and merge PDF files by selecting pages from one or more input
2201 files. 2208 files.
2202 2209
2203 -Usage: :samp:`qpdf {in.pdf} --pages input-file [ --password={password} ] [ {page-range} ] [ ... ] -- {out.pdf}` 2210 +Usage: :samp:`qpdf {in.pdf} --pages input-file [--password={password}] [{page-range}] [...] -- {out.pdf}`
2204 2211
2205 Between ``--pages`` and the ``--`` that terminates pages option, 2212 Between ``--pages`` and the ``--`` that terminates pages option,
2206 repeat the following: 2213 repeat the following:
2207 2214
2208 -:samp:`{filename} [ --password={password} ] [ {page-range} ]` 2215 +:samp:`{filename} [--password={password}] [{page-range}]`
2209 2216
2210 Notes: 2217 Notes:
2211 - The password option is needed only for password-protected files. 2218 - The password option is needed only for password-protected files.
@@ -2424,10 +2431,10 @@ Overlay and Underlay @@ -2424,10 +2431,10 @@ Overlay and Underlay
2424 drawn below the destination page. Usage: 2431 drawn below the destination page. Usage:
2425 2432
2426 {--overlay | --underlay } file 2433 {--overlay | --underlay } file
2427 - [ --password=password ]  
2428 - [ --to=page-range ]  
2429 - [ --from=[page-range] ]  
2430 - [ --repeat=page-range ] 2434 + [--password=password]
  2435 + [--to=page-range]
  2436 + [--from=[page-range]]
  2437 + [--repeat=page-range]
2431 -- 2438 --
2432 2439
2433 Note the use of "--" by itself to terminate overlay/underlay options. 2440 Note the use of "--" by itself to terminate overlay/underlay options.
@@ -2447,7 +2454,7 @@ as follows: @@ -2447,7 +2454,7 @@ as follows:
2447 2454
2448 :: 2455 ::
2449 2456
2450 - { --overlay | --underlay } file [ options ] -- 2457 + { --overlay | --underlay } file [options] --
2451 2458
2452 Overlay and underlay options are processed late, so they can be 2459 Overlay and underlay options are processed late, so they can be
2453 combined with other options like merging and will apply to the final 2460 combined with other options like merging and will apply to the final
manual/qdf.rst
@@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
3 QDF Mode 3 QDF Mode
4 ======== 4 ========
5 5
  6 +.. Help text for --qdf refers to the name of this chapter.
  7 +
6 In QDF mode, qpdf creates PDF files in what we call *QDF 8 In QDF mode, qpdf creates PDF files in what we call *QDF
7 form*. A PDF file in QDF form, sometimes called a QDF 9 form*. A PDF file in QDF form, sometimes called a QDF
8 file, is a completely valid PDF file that has ``%QDF-1.0`` as its third 10 file, is a completely valid PDF file that has ``%QDF-1.0`` as its third