Commit acf8d18b6e41ec9786bd059795731e92998620ab

Authored by Jay Berkenbilt
1 parent cf8405d9

Editorial changes to cli.rst

job.sums
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 generate_auto_job 466aa9211549cebeb3fedc6413108981aeeddd89936621095f5f5223cee9880b 2 generate_auto_job 466aa9211549cebeb3fedc6413108981aeeddd89936621095f5f5223cee9880b
3 job.yml 8177cadf41096efdc174f04daadfe5d98c592ad44ad10cb96537521fd79a801a 3 job.yml 8177cadf41096efdc174f04daadfe5d98c592ad44ad10cb96537521fd79a801a
4 libqpdf/qpdf/auto_job_decl.hh 97395ecbe590b23ae04d6cce2080dbd0e998917ff5eeaa5c6aafa91041d3cd6a 4 libqpdf/qpdf/auto_job_decl.hh 97395ecbe590b23ae04d6cce2080dbd0e998917ff5eeaa5c6aafa91041d3cd6a
5 -libqpdf/qpdf/auto_job_help.hh 4dd6a958745b793320d0c657e23b670918e29f4d3dd6d78477d87df3eca2a910 5 +libqpdf/qpdf/auto_job_help.hh 9f4bd3e42510446a714771143e6a1db599a614818329d6c7126bb9fbcccd1f36
6 libqpdf/qpdf/auto_job_init.hh 465bf46769559ceb77110d1b9d3293ba9b3595850b49848c31aeabd10aadb4ad 6 libqpdf/qpdf/auto_job_init.hh 465bf46769559ceb77110d1b9d3293ba9b3595850b49848c31aeabd10aadb4ad
7 manual/_ext/qpdf.py 855fe12de5af7a10bb24be6ecc4d5dff4c84ac58cf388a13be6bbb394346a67d 7 manual/_ext/qpdf.py 855fe12de5af7a10bb24be6ecc4d5dff4c84ac58cf388a13be6bbb394346a67d
8 -manual/cli.rst e99e45275cdbc902b4860091453ae08e7b356da6301c5dc622982ec326e87e2a 8 +manual/cli.rst a1d5a72677eed46cfc91dba7cde8163107594adecb7f7362f0d402dea59833bd
libqpdf/qpdf/auto_job_help.hh
@@ -173,7 +173,7 @@ streams uncompressed intentionally. @@ -173,7 +173,7 @@ streams uncompressed intentionally.
173 } 173 }
174 static void add_help_3(QPDFArgParser& ap) 174 static void add_help_3(QPDFArgParser& ap)
175 { 175 {
176 -ap.addOptionHelp("--decode-level", "transformation", "control which streams to uncompress", R"(--decode-level=option 176 +ap.addOptionHelp("--decode-level", "transformation", "control which streams to uncompress", R"(--decode-level=parameter
177 177
178 When uncompressing streams, control which types of compression 178 When uncompressing streams, control which types of compression
179 schemes should be uncompressed: 179 schemes should be uncompressed:
@@ -187,13 +187,13 @@ schemes should be uncompressed: @@ -187,13 +187,13 @@ schemes should be uncompressed:
187 with lossy compression schemes like JPEG (DCT) 187 with lossy compression schemes like JPEG (DCT)
188 qpdf does not know how to uncompress all compression schemes. 188 qpdf does not know how to uncompress all compression schemes.
189 )"); 189 )");
190 -ap.addOptionHelp("--stream-data", "transformation", "control stream compression", R"(--stream-data=option 190 +ap.addOptionHelp("--stream-data", "transformation", "control stream compression", R"(--stream-data=parameter
191 191
192 This option controls how streams are compressed in the output. 192 This option controls how streams are compressed in the output.
193 It is less granular than the newer options, --compress-streams 193 It is less granular than the newer options, --compress-streams
194 and --decode-level. 194 and --decode-level.
195 195
196 -Options: 196 +Parameters:
197 - compress: same as --compress-streams=y --decode-level=generalized 197 - compress: same as --compress-streams=y --decode-level=generalized
198 - preserve: same as --compress-streams=n --decode-level=none 198 - preserve: same as --compress-streams=n --decode-level=none
199 - uncompress: same as --compress-streams=n --decode-level=generalized 199 - uncompress: same as --compress-streams=n --decode-level=generalized
@@ -228,10 +228,10 @@ Control what qpdf does regarding object streams. Options: @@ -228,10 +228,10 @@ Control what qpdf does regarding object streams. Options:
228 )"); 228 )");
229 ap.addOptionHelp("--preserve-unreferenced", "transformation", "preserve unreferenced objects", R"(Preserve all objects from the input even if not referenced. 229 ap.addOptionHelp("--preserve-unreferenced", "transformation", "preserve unreferenced objects", R"(Preserve all objects from the input even if not referenced.
230 )"); 230 )");
231 -ap.addOptionHelp("--remove-unreferenced-resources", "transformation", "remove unreferenced page resources", R"(--remove-unreferenced-resources=option 231 +ap.addOptionHelp("--remove-unreferenced-resources", "transformation", "remove unreferenced page resources", R"(--remove-unreferenced-resources=parameter
232 232
233 Remove from a page's resource dictionary any resources that are 233 Remove from a page's resource dictionary any resources that are
234 -not referenced in the page's contents. Options: "auto" 234 +not referenced in the page's contents. Parameters: "auto"
235 (default), "yes", "no". 235 (default), "yes", "no".
236 )"); 236 )");
237 ap.addOptionHelp("--preserve-unreferenced-resources", "transformation", "use --remove-unreferenced-resources=no", R"(Synonym for --remove-unreferenced-resources=no. Use that instead. 237 ap.addOptionHelp("--preserve-unreferenced-resources", "transformation", "use --remove-unreferenced-resources=no", R"(Synonym for --remove-unreferenced-resources=no. Use that instead.
@@ -283,7 +283,7 @@ Run qpdf --help=page-selection for details. @@ -283,7 +283,7 @@ Run qpdf --help=page-selection for details.
283 ap.addOptionHelp("--collate", "modification", "collate with --pages", R"(--collate=n 283 ap.addOptionHelp("--collate", "modification", "collate with --pages", R"(--collate=n
284 284
285 Collate rather than concatenate pages specified with --pages. 285 Collate rather than concatenate pages specified with --pages.
286 -With a numeric argument, collate in groups of n. The default 286 +With a numeric parameter, collate in groups of n. The default
287 is 1. Run qpdf --help=page-selection for additional details. 287 is 1. Run qpdf --help=page-selection for additional details.
288 )"); 288 )");
289 } 289 }
@@ -321,11 +321,11 @@ ap.addOptionHelp("--flatten-rotation", "modification", "remove rotation from pag @@ -321,11 +321,11 @@ ap.addOptionHelp("--flatten-rotation", "modification", "remove rotation from pag
321 metadata. This can be useful if a broken PDF viewer fails to 321 metadata. This can be useful if a broken PDF viewer fails to
322 properly consider page rotation metadata. 322 properly consider page rotation metadata.
323 )"); 323 )");
324 -ap.addOptionHelp("--flatten-annotations", "modification", "push annotations into content", R"(--flatten-annotations=option 324 +ap.addOptionHelp("--flatten-annotations", "modification", "push annotations into content", R"(--flatten-annotations=parameter
325 325
326 Push page annotations into the content streams. This may be 326 Push page annotations into the content streams. This may be
327 necessary in some case when printing or splitting files. 327 necessary in some case when printing or splitting files.
328 -Options: "all", "print", "screen". 328 +Parameters: "all", "print", "screen".
329 )"); 329 )");
330 ap.addOptionHelp("--rotate", "modification", "rotate pages", R"(--rotate=[+|-]angle[:page-range] 330 ap.addOptionHelp("--rotate", "modification", "rotate pages", R"(--rotate=[+|-]angle[:page-range]
331 331
manual/cli.rst
@@ -13,11 +13,34 @@ @@ -13,11 +13,34 @@
13 for additional help. Command line arguments can be referenced using 13 for additional help. Command line arguments can be referenced using
14 :qpdf:ref:`--option`. They also appear in an index. 14 :qpdf:ref:`--option`. They also appear in an index.
15 15
  16 + STYLE NOTES
  17 +
16 In this text, :samp:`...` and ``...`` are used somewhat 18 In this text, :samp:`...` and ``...`` are used somewhat
17 interchangeably. :samp: should be used when there is replaceable 19 interchangeably. :samp: should be used when there is replaceable
18 text enclosed in curly braces. Otherwise, either is fine. Ideally 20 text enclosed in curly braces. Otherwise, either is fine. Ideally
19 there should be a stricter editorial convention, but they render 21 there should be a stricter editorial convention, but they render
20 - the same, so I have not gone to the trouble of making it consistent. 22 + the same, so I have not gone to the trouble of making it
  23 + consistent.
  24 +
  25 + USE :qpdf:ref:`--option` to refer to an option whenever it is
  26 + specified without parameters in any place other than its own help.
  27 + This creates a link.
  28 +
  29 + When referring to command-line options, use the following
  30 + terminology:
  31 +
  32 + argument: any command-line argument whether option or positional
  33 + option: any argument starting with -- including its parameter, if any
  34 + flag: the --flag part of the option; only use to disambiguate
  35 + parameter: the parameter part of the option
  36 +
  37 + Example: qpdf in.pdf --object-stream=generalized out.pdf
  38 +
  39 + Each word is an argument.
  40 + The "--object-stream=generalized" option consists of
  41 + the "--object-stream" flag with the "generalized" parameter. It
  42 + would be okay to talk about "the --object-stream option" in the
  43 + text if there's no ambiguity.
21 44
22 .. _using: 45 .. _using:
23 46
@@ -58,23 +81,24 @@ Basic Invocation @@ -58,23 +81,24 @@ Basic Invocation
58 The :command:`qpdf` command reads the PDF file :samp:`{infile}`, 81 The :command:`qpdf` command reads the PDF file :samp:`{infile}`,
59 applies various transformations or modifications to the file in 82 applies various transformations or modifications to the file in
60 memory, and writes the results to :samp:`{outfile}`. When run with no 83 memory, and writes the results to :samp:`{outfile}`. When run with no
61 -arguments, the output file is functionally identical to the input file 84 +options, the output file is functionally identical to the input file
62 but may be structurally reorganized, and orphaned objects are removed 85 but may be structurally reorganized, and orphaned objects are removed
63 from the file. Many options are available for applying transformations 86 from the file. Many options are available for applying transformations
64 or modifications to the file. 87 or modifications to the file.
65 88
66 :samp:`{infile}` can be a regular file, or it can be 89 :samp:`{infile}` can be a regular file, or it can be
67 -:qpdf:ref:`--empty` to start with an empty PDF file. :samp:`{outfile}`  
68 -can be a regular file, ``-`` to represent standard output, or  
69 -:qpdf:ref:`--replace-input` to indicate that the input file should be  
70 -overwritten. The output file does not have to be seekable, even when  
71 -generating linearized files. The input file *does* have to be  
72 -seekable. You can't read from standard input or a pipe. You can also  
73 -use :qpdf:ref:`--split-pages` to create separate output files for each 90 +:qpdf:ref:`--empty` to start with an empty PDF file. There is no way
  91 +to use standard input since the input file has to be seekable.
  92 +
  93 +:samp:`{outfile}` can be a regular file, ``-`` to represent standard
  94 +output, or :qpdf:ref:`--replace-input` to indicate that the input file
  95 +should be overwritten. The output file does not have to be seekable,
  96 +even when generating linearized files. You can also use
  97 +:qpdf:ref:`--split-pages` to create separate output files for each
74 page (or group of pages) instead of a single output file. 98 page (or group of pages) instead of a single output file.
  99 +
75 Password-protected files may be opened by specifying a password with 100 Password-protected files may be opened by specifying a password with
76 -:qpdf:ref:`--password`. These and many other options are discussed in  
77 -the remaining sections of this chapter. 101 +:qpdf:ref:`--password`.
78 102
79 All options other than help options (see :ref:`help-options`) require 103 All options other than help options (see :ref:`help-options`) require
80 an input file. If inspection options (see :ref:`inspection-options`) 104 an input file. If inspection options (see :ref:`inspection-options`)
@@ -92,8 +116,8 @@ is also very useful for avoiding having to pass passwords on the @@ -92,8 +116,8 @@ is also very useful for avoiding having to pass passwords on the
92 command line, though see also :qpdf:ref:`--password-file`. Note that 116 command line, though see also :qpdf:ref:`--password-file`. Note that
93 the :samp:`@filename` can't appear in the middle of an argument, so 117 the :samp:`@filename` can't appear in the middle of an argument, so
94 constructs such as :samp:`--arg=@filename` will not work. Instead, you 118 constructs such as :samp:`--arg=@filename` will not work. Instead, you
95 -would have to include the argument and its parameter (e.g.,  
96 -:samp:`--arg=parameter`) as a line in the :file:`filename` file and 119 +would have to include the option and its parameter (e.g.,
  120 +:samp:`--option=parameter`) as a line in the :file:`filename` file and
97 just pass :samp:`@filename` on the command line. 121 just pass :samp:`@filename` on the command line.
98 122
99 Related Options 123 Related Options
@@ -501,7 +525,7 @@ Related Options @@ -501,7 +525,7 @@ Related Options
501 Overrides the usual computation/retrieval of the PDF file's 525 Overrides the usual computation/retrieval of the PDF file's
502 encryption key from user/owner password with an explicit 526 encryption key from user/owner password with an explicit
503 specification of the encryption key. When this option is specified, 527 specification of the encryption key. When this option is specified,
504 - the argument to the :qpdf:ref:`--password` option is interpreted as 528 + the parameter to the :qpdf:ref:`--password` option is interpreted as
505 a hexadecimal-encoded key value. This only applies to the password 529 a hexadecimal-encoded key value. This only applies to the password
506 used to open the main input file. It does not apply to other files 530 used to open the main input file. It does not apply to other files
507 opened by :qpdf:ref:`--pages` or other options or to files being 531 opened by :qpdf:ref:`--pages` or other options or to files being
@@ -791,7 +815,7 @@ Related Options @@ -791,7 +815,7 @@ Related Options
791 :samp:`--compress-streams=n`. In QDF mode (see :ref:`qdf` and 815 :samp:`--compress-streams=n`. In QDF mode (see :ref:`qdf` and
792 :qpdf:ref:`--qdf`), the default is to leave streams uncompressed. 816 :qpdf:ref:`--qdf`), the default is to leave streams uncompressed.
793 817
794 -.. qpdf:option:: --decode-level=option 818 +.. qpdf:option:: --decode-level=parameter
795 819
796 .. help: control which streams to uncompress 820 .. help: control which streams to uncompress
797 821
@@ -810,7 +834,7 @@ Related Options @@ -810,7 +834,7 @@ Related Options
810 Controls which streams qpdf tries to decode. The default is 834 Controls which streams qpdf tries to decode. The default is
811 :samp:`generalized`. 835 :samp:`generalized`.
812 836
813 - The following options are available: 837 + The following values for :samp:`{parameter}` are available:
814 838
815 - :samp:`none`: do not attempt to decode any streams 839 - :samp:`none`: do not attempt to decode any streams
816 840
@@ -847,7 +871,7 @@ Related Options @@ -847,7 +871,7 @@ Related Options
847 are not uncompressed and recompressed. You can change this behavior 871 are not uncompressed and recompressed. You can change this behavior
848 with :qpdf:ref:`--recompress-flate`. 872 with :qpdf:ref:`--recompress-flate`.
849 873
850 -.. qpdf:option:: --stream-data=option 874 +.. qpdf:option:: --stream-data=parameter
851 875
852 .. help: control stream compression 876 .. help: control stream compression
853 877
@@ -855,7 +879,7 @@ Related Options @@ -855,7 +879,7 @@ Related Options
855 It is less granular than the newer options, --compress-streams 879 It is less granular than the newer options, --compress-streams
856 and --decode-level. 880 and --decode-level.
857 881
858 - Options: 882 + Parameters:
859 - compress: same as --compress-streams=y --decode-level=generalized 883 - compress: same as --compress-streams=y --decode-level=generalized
860 - preserve: same as --compress-streams=n --decode-level=none 884 - preserve: same as --compress-streams=n --decode-level=none
861 - uncompress: same as --compress-streams=n --decode-level=generalized 885 - uncompress: same as --compress-streams=n --decode-level=generalized
@@ -863,7 +887,7 @@ Related Options @@ -863,7 +887,7 @@ Related Options
863 Controls transformation of stream data. This option predates the 887 Controls transformation of stream data. This option predates the
864 :qpdf:ref:`--compress-streams` and :qpdf:ref:`--decode-level` 888 :qpdf:ref:`--compress-streams` and :qpdf:ref:`--decode-level`
865 options. Those options can be used to achieve the same affect with 889 options. Those options can be used to achieve the same affect with
866 - more control. The value of :samp:`{option}` may be one of the 890 + more control. The value of :samp:`{parameter}` may be one of the
867 following: 891 following:
868 892
869 - :samp:`compress`: recompress stream data when possible (default); 893 - :samp:`compress`: recompress stream data when possible (default);
@@ -1009,15 +1033,15 @@ Related Options @@ -1009,15 +1033,15 @@ Related Options
1009 See also :qpdf:ref:`--preserve-unreferenced-resources`, which does 1033 See also :qpdf:ref:`--preserve-unreferenced-resources`, which does
1010 something completely different. 1034 something completely different.
1011 1035
1012 -.. qpdf:option:: --remove-unreferenced-resources=option 1036 +.. qpdf:option:: --remove-unreferenced-resources=parameter
1013 1037
1014 .. help: remove unreferenced page resources 1038 .. help: remove unreferenced page resources
1015 1039
1016 Remove from a page's resource dictionary any resources that are 1040 Remove from a page's resource dictionary any resources that are
1017 - not referenced in the page's contents. Options: "auto" 1041 + not referenced in the page's contents. Parameters: "auto"
1018 (default), "yes", "no". 1042 (default), "yes", "no".
1019 1043
1020 - Options: ``auto`` (the default), ``yes``, or ``no``. 1044 + Parameters: ``auto`` (the default), ``yes``, or ``no``.
1021 1045
1022 Starting with qpdf 8.1, when splitting pages, qpdf is able to 1046 Starting with qpdf 8.1, when splitting pages, qpdf is able to
1023 attempt to remove images and fonts that are not used by a page even 1047 attempt to remove images and fonts that are not used by a page even
@@ -1189,8 +1213,8 @@ Page Ranges @@ -1189,8 +1213,8 @@ Page Ranges
1189 :even starts with the second page. These are odd and even pages 1213 :even starts with the second page. These are odd and even pages
1190 from the resulting set, not based on the original page numbers. 1214 from the resulting set, not based on the original page numbers.
1191 1215
1192 -Several :command:`qpdf` command-line arguments accept page ranges as  
1193 -options. This section describes the syntax of a page range. 1216 +Several :command:`qpdf` command-line options use page ranges. This
  1217 +section describes the syntax of a page range.
1194 1218
1195 - A plain number indicates a page numbered from ``1``, so ``1`` 1219 - A plain number indicates a page numbered from ``1``, so ``1``
1196 represents the first page. 1220 represents the first page.
@@ -1290,12 +1314,12 @@ Related Options @@ -1290,12 +1314,12 @@ Related Options
1290 .. help: collate with --pages 1314 .. help: collate with --pages
1291 1315
1292 Collate rather than concatenate pages specified with --pages. 1316 Collate rather than concatenate pages specified with --pages.
1293 - With a numeric argument, collate in groups of n. The default 1317 + With a numeric parameter, collate in groups of n. The default
1294 is 1. Run qpdf --help=page-selection for additional details. 1318 is 1. Run qpdf --help=page-selection for additional details.
1295 1319
1296 This option causes :command:`qpdf` to collate rather than 1320 This option causes :command:`qpdf` to collate rather than
1297 concatenate pages specified with :qpdf:ref:`--pages`. With a 1321 concatenate pages specified with :qpdf:ref:`--pages`. With a
1298 - numeric argument, collate in groups of :samp:`{n}`. The default 1322 + numeric parameter, collate in groups of :samp:`{n}`. The default
1299 is 1. 1323 is 1.
1300 1324
1301 Please see :ref:`page-selection` for additional details. 1325 Please see :ref:`page-selection` for additional details.
@@ -1403,13 +1427,13 @@ Related Options @@ -1403,13 +1427,13 @@ Related Options
1403 reason to use this option unless you are working around a specific 1427 reason to use this option unless you are working around a specific
1404 problem. 1428 problem.
1405 1429
1406 -.. qpdf:option:: --flatten-annotations=option 1430 +.. qpdf:option:: --flatten-annotations=parameter
1407 1431
1408 .. help: push annotations into content 1432 .. help: push annotations into content
1409 1433
1410 Push page annotations into the content streams. This may be 1434 Push page annotations into the content streams. This may be
1411 necessary in some case when printing or splitting files. 1435 necessary in some case when printing or splitting files.
1412 - Options: "all", "print", "screen". 1436 + Parameters: "all", "print", "screen".
1413 1437
1414 This option collapses annotations into the pages' contents with 1438 This option collapses annotations into the pages' contents with
1415 special handling for form fields. Ordinarily, an annotation is 1439 special handling for form fields. Ordinarily, an annotation is
@@ -1419,10 +1443,10 @@ Related Options @@ -1419,10 +1443,10 @@ Related Options
1419 transformations. The library functionality backing this option was 1443 transformations. The library functionality backing this option was
1420 added for the benefit of programs that want to create *n-up* page 1444 added for the benefit of programs that want to create *n-up* page
1421 layouts and other similar things that don't work well with 1445 layouts and other similar things that don't work well with
1422 - annotations. The :samp:`{option}` parameter may be any of the 1446 + annotations. The value of :samp:`{parameter}` may be any of the
1423 following: 1447 following:
1424 1448
1425 - .. list-table:: Flatten Annotation Options 1449 + .. list-table:: Flatten Annotation Parameters
1426 :widths: 10 80 1450 :widths: 10 80
1427 :header-rows: 0 1451 :header-rows: 0
1428 1452
@@ -2168,7 +2192,7 @@ repeat the following: @@ -2168,7 +2192,7 @@ repeat the following:
2168 :samp:`{filename} [ --password={password} ] [ {page-range} ]` 2192 :samp:`{filename} [ --password={password} ] [ {page-range} ]`
2169 2193
2170 Notes: 2194 Notes:
2171 - - The password argument is needed only for password-protected files. 2195 + - The password option is needed only for password-protected files.
2172 If you specify the same file more than once, you only need to supply 2196 If you specify the same file more than once, you only need to supply
2173 the password the first time. 2197 the password the first time.
2174 2198
@@ -2255,7 +2279,7 @@ Examples @@ -2255,7 +2279,7 @@ Examples
2255 2279
2256 - a.pdf page 5 2280 - a.pdf page 5
2257 2281
2258 -- You can specify a numeric argument to :qpdf:ref:`--collate`. With 2282 +- You can specify a numeric parameter to :qpdf:ref:`--collate`. With
2259 :samp:`--collate={n}`, pull groups of :samp:`{n}` pages from each 2283 :samp:`--collate={n}`, pull groups of :samp:`{n}` pages from each
2260 file, as always, stopping when there are no more pages. For example, 2284 file, as always, stopping when there are no more pages. For example,
2261 if you ran 2285 if you ran
@@ -2917,7 +2941,7 @@ Related Options @@ -2917,7 +2941,7 @@ Related Options
2917 :qpdf:ref:`--check` or :qpdf:ref:`--show-encryption` is given, display the 2941 :qpdf:ref:`--check` or :qpdf:ref:`--show-encryption` is given, display the
2918 computed or retrieved encryption key as a hexadecimal string. This 2942 computed or retrieved encryption key as a hexadecimal string. This
2919 value is not ordinarily useful to users, but it can be used as the 2943 value is not ordinarily useful to users, but it can be used as the
2920 - argument to :qpdf:ref:`--password` if the :qpdf:ref:`--password-is-hex-key` 2944 + parameter to :qpdf:ref:`--password` if the :qpdf:ref:`--password-is-hex-key`
2921 is specified. Note that, when PDF files are encrypted, passwords 2945 is specified. Note that, when PDF files are encrypted, passwords
2922 and other metadata are used only to compute an encryption key, and 2946 and other metadata are used only to compute an encryption key, and
2923 the encryption key is what is actually used for encryption. This 2947 the encryption key is what is actually used for encryption. This