Commit a6df6fdaf724ed5fc6f7e8c021f7804bd5a9c0e2

Authored by Jay Berkenbilt
1 parent c529c28d

CLI doc: use tables where helpful

job.sums
... ... @@ -2,7 +2,7 @@
2 2 generate_auto_job 466aa9211549cebeb3fedc6413108981aeeddd89936621095f5f5223cee9880b
3 3 job.yml 8177cadf41096efdc174f04daadfe5d98c592ad44ad10cb96537521fd79a801a
4 4 libqpdf/qpdf/auto_job_decl.hh 97395ecbe590b23ae04d6cce2080dbd0e998917ff5eeaa5c6aafa91041d3cd6a
5   -libqpdf/qpdf/auto_job_help.hh fa7ff1d1f6289881ac3a485107d15240c4992c59cff506be425354557108d184
  5 +libqpdf/qpdf/auto_job_help.hh 4dd6a958745b793320d0c657e23b670918e29f4d3dd6d78477d87df3eca2a910
6 6 libqpdf/qpdf/auto_job_init.hh 465bf46769559ceb77110d1b9d3293ba9b3595850b49848c31aeabd10aadb4ad
7 7 manual/_ext/qpdf.py 855fe12de5af7a10bb24be6ecc4d5dff4c84ac58cf388a13be6bbb394346a67d
8   -manual/cli.rst 7a36de7413b5c2867de573b5a9beff862e28c46123b72d08e3971ddf5bdf3bbe
  8 +manual/cli.rst e99e45275cdbc902b4860091453ae08e7b356da6301c5dc622982ec326e87e2a
... ...
libqpdf/qpdf/auto_job_help.hh
... ... @@ -721,7 +721,7 @@ aspects of the file, and write information about the file to
721 721 standard output. Note that qpdf does not perform any validation
722 722 of the actual PDF page content or semantic correctness of the
723 723 PDF file. It merely checks that the PDF file is syntactically
724   -valid.
  724 +valid. See also qpdf --help=exit-status.
725 725 )");
726 726 ap.addOptionHelp("--show-encryption", "copy-attachments", "information about encrypted files", R"(Show document encryption parameters. Also show the document's
727 727 user password if the owner password is given and the file was
... ...
manual/cli.rst
... ... @@ -141,25 +141,36 @@ Exit Status
141 141  
142 142 The exit status of :command:`qpdf` may be interpreted as follows:
143 143  
144   -- ``0``: no errors or warnings were found. The file may still have
145   - problems qpdf can't detect. If :qpdf:ref:`--warning-exit-0` was
146   - specified, exit status ``0`` is used even if there are warnings.
  144 +.. list-table:: Exit Codes
  145 + :widths: 5 80
  146 + :header-rows: 0
147 147  
148   -- ``1``: :command:`qpdf` does not exit with status ``1`` since the
149   - shell uses this exit code if it is unable to invoke the command.
  148 + - - 0
  149 + - no errors or warnings were found
150 150  
151   -- ``2``: errors were found. qpdf was not able to fully process the
152   - file.
  151 + - - 1
  152 + - not used
153 153  
154   -- ``3``: qpdf encountered problems that it was able to recover from.
155   - In some cases, the resulting file may still be damaged. Note that
156   - qpdf still exits with status ``3`` if it finds warnings even when
157   - :qpdf:ref:`--no-warn` is specified. With
158   - :qpdf:ref:`--warning-exit-0`, warnings without errors exit with
159   - status ``0`` instead of ``3``.
  154 + - - 2
  155 + - errors were found; the file was not processed
160 156  
161   -The :qpdf:ref:`--is-encrypted` and :qpdf:ref:`--requires-password`
162   -options use different exit codes. See their help for details.
  157 + - - 3
  158 + - warnings were found without errors
  159 +
  160 +Notes:
  161 +
  162 +- A PDF file may have problems that qpdf can't detect.
  163 +
  164 +- With the :qpdf:ref:`--warning-exit-0` option, exit status ``0`` is
  165 + used even if there are warnings.
  166 +
  167 +- :command:`qpdf` does not exit with status ``1`` since the shell uses
  168 + this exit code if it is unable to invoke the command.
  169 +
  170 +- If both errors and warnings were found, exit status ``2`` is used.
  171 +
  172 +- The :qpdf:ref:`--is-encrypted` and :qpdf:ref:`--requires-password`
  173 + options use different exit codes. See their help for details.
163 174  
164 175 Related Options
165 176 ~~~~~~~~~~~~~~~
... ... @@ -938,13 +949,18 @@ Related Options
938 949 Controls handling of object streams. The value of :samp:`{mode}`
939 950 may be one of the following:
940 951  
941   - - :samp:`preserve`: preserve original object streams, if any (the
942   - default)
  952 + .. list-table:: Object Stream Modes
  953 + :widths: 10 80
  954 + :header-rows: 0
  955 +
  956 + - - :samp:`preserve`
  957 + - preserve original object streams, if any (the default)
943 958  
944   - - :samp:`disable`: create output files with no object streams
  959 + - - :samp:`disable`
  960 + - create output files with no object streams
945 961  
946   - - :samp:`generate`: create object streams, and compress objects
947   - when possible
  962 + - - :samp:`generate`
  963 + - create object streams, and compress objects when possible
948 964  
949 965 Object streams are PDF streams that contain other objects. Putting
950 966 objects in object streams allows the PDF objects themselves to be
... ... @@ -1195,34 +1211,47 @@ options. This section describes the syntax of a page range.
1195 1211 case, odd and even refer to positions in the final range, not
1196 1212 whether the original page number is odd or even.
1197 1213  
1198   -Example page ranges:
  1214 +.. list-table:: Example Page Ranges
  1215 + :widths: 20 80
  1216 + :header-rows: 0
1199 1217  
1200   -- ``1,6,4``: pages 1, 6, and 4 in that order
  1218 + - - ``1,6,4``
  1219 + - pages 1, 6, and 4 in that order
1201 1220  
1202   -- ``3-7``: pages 3 through 7 inclusive in increasing order
  1221 + - - ``3-7``
  1222 + - pages 3 through 7 inclusive in increasing order
1203 1223  
1204   -- ``7-3``: pages 7, 6, 5, 4, and 3 in that order
  1224 + - - ``7-3``
  1225 + - pages 7, 6, 5, 4, and 3 in that order
1205 1226  
1206   -- ``1-z``: all pages in order
  1227 + - - ``1-z``
  1228 + - all pages in order
1207 1229  
1208   -- ``z-1``: all pages in reverse order
  1230 + - - ``z-1``
  1231 + - all pages in reverse order
1209 1232  
1210   -- ``1,3,5-9,15-12``: pages 1, 3, 5, 6, 7, 8, 9, 15, 14, 13, and 12 in
1211   - that order
  1233 + - - ``1,3,5-9,15-12``
  1234 + - pages 1, 3, 5, 6, 7, 8, 9, 15, 14, 13, and 12 in that order
1212 1235  
1213   -- ``r3-r1``: the last three pages of the document
  1236 + - - ``r3-r1``
  1237 + - the last three pages of the document
1214 1238  
1215   -- ``r1-r3``: the last three pages of the document in reverse order
  1239 + - - ``r1-r3``
  1240 + - the last three pages of the document in reverse order
1216 1241  
1217   -- ``1-20:even``: even pages from 2 to 20
  1242 + - - ``1-20:even``
  1243 + - even pages from 2 to 20
1218 1244  
1219   -- ``5,7-9,12``: pages 5, 7, 8, 9, and 12
  1245 + - - ``5,7-9,12``
  1246 + - pages 5, 7, 8, 9, and 12
1220 1247  
1221   -- ``5,7-9,12:odd``: pages 5, 8, and 12, which are the pages in odd
1222   - positions from the original set of 5, 7, 8, 9, 12
  1248 + - - ``5,7-9,12:odd``
  1249 + - pages 5, 8, and 12, which are the pages in odd positions from
  1250 + the original set of 5, 7, 8, 9, 12
1223 1251  
1224   -- ``5,7-9,12:even``: pages 7 and 9, which are the pages in even
1225   - positions from the original set of 5, 7, 8, 9, 12
  1252 + - - ``5,7-9,12:even``
  1253 + - pages 7 and 9, which are the pages in even positions from the
  1254 + original set of 5, 7, 8, 9, 12
1226 1255  
1227 1256 .. _modification-options:
1228 1257  
... ... @@ -1393,14 +1422,20 @@ Related Options
1393 1422 annotations. The :samp:`{option}` parameter may be any of the
1394 1423 following:
1395 1424  
1396   - - :samp:`all`: include all annotations that are not marked
1397   - invisible or hidden
  1425 + .. list-table:: Flatten Annotation Options
  1426 + :widths: 10 80
  1427 + :header-rows: 0
  1428 +
  1429 + - - :samp:`all`
  1430 + - include all annotations that are not marked invisible or
  1431 + hidden
1398 1432  
1399   - - :samp:`print`: only include annotations that indicate that they
1400   - should appear when the page is printed
  1433 + - - :samp:`print`
  1434 + - only include annotations that should appear when the page is
  1435 + printed
1401 1436  
1402   - - :samp:`screen`: omit annotations that indicate they should not
1403   - appear on the screen
  1437 + - - :samp:`screen`
  1438 + - omit annotations that should not appear on the screen
1404 1439  
1405 1440 In a PDF file, interactive form fields have a value and,
1406 1441 independently, a set of instructions, called an appearance, to
... ... @@ -1702,63 +1737,109 @@ does not obey encryption restrictions already imposed on the file.
1702 1737 Doing so would be meaningless since qpdf can be used to remove
1703 1738 encryption from the file entirely.
1704 1739  
1705   -Here is a summary of encryption options. Details are provided below.
  1740 +Here is a summary of encryption options. Details are provided in the
  1741 +help for each option.
  1742 +
  1743 +
  1744 +.. list-table:: Options for 40-bit Encryption Only
  1745 + :widths: 30 70
  1746 + :header-rows: 0
  1747 +
  1748 + - - ``--annotate=[yn]``
  1749 + - restrict comments, filling forms, and signing
1706 1750  
1707   -Options for 40-bit only
1708   - - ``--annotate=[yn]``: restrict comments, filling forms, and signing
  1751 + - - ``--extract=[yn]``
  1752 + - restrict text/graphic extraction
1709 1753  
1710   - - ``--extract=[yn]``: restrict text/graphic extraction
  1754 + - - ``--modify=[yn]``
  1755 + - restrict document modification
1711 1756  
1712   - - ``--modify=[yn]``: restrict document modification
  1757 + - - ``--print=[yn]``
  1758 + - restrict printing
1713 1759  
1714   - - ``--print=[yn]``: restrict printing
  1760 +.. list-table:: Options for 128-bit or 256-bit Encryption
  1761 + :widths: 30 70
  1762 + :header-rows: 0
1715 1763  
1716   -Options for 128-bit or 256-bit
1717   - - ``--accessibility=[yn]``: restrict accessibility (usually ignored)
  1764 + - - ``--accessibility=[yn]``
  1765 + - restrict accessibility (usually ignored)
1718 1766  
1719   - - ``--annotate=[yn]``: restrict commenting/filling form fields
  1767 + - - ``--annotate=[yn]``
  1768 + - restrict commenting/filling form fields
1720 1769  
1721   - - ``--assemble=[yn]``: restrict document assembly
  1770 + - - ``--assemble=[yn]``
  1771 + - restrict document assembly
1722 1772  
1723   - - ``--extract=[yn]``: restrict text/graphic extraction
  1773 + - - ``--extract=[yn]``
  1774 + - restrict text/graphic extraction
1724 1775  
1725   - - ``--form=[yn]``: restrict filling form fields
  1776 + - - ``--form=[yn]``
  1777 + - restrict filling form fields
1726 1778  
1727   - - ``--modify-other=[yn]``: restrict other modifications
  1779 + - - ``--modify-other=[yn]``
  1780 + - restrict other modifications
1728 1781  
1729   - - ``--modify=modify-opt``: control modify access by level
  1782 + - - ``--modify=modify-opt``
  1783 + - control modify access by level
1730 1784  
1731   - - ``--print=print-opt``: control printing access
  1785 + - - ``--print=print-opt``
  1786 + - control printing access
1732 1787  
1733   - - ``--cleartext-metadata``: prevent encryption of metadata
  1788 + - - ``--cleartext-metadata``
  1789 + - prevent encryption of metadata
1734 1790  
1735   -For 128-bit only
1736   - - ``--use-aes=[yn]``: indicates whether to use AES encryption
  1791 +.. list-table:: Options for 128-bit Encryption Only
  1792 + :widths: 30 70
  1793 + :header-rows: 0
1737 1794  
1738   - - ``--force-V4``: forces use of V=4 encryption handler
  1795 + - - ``--use-aes=[yn]``
  1796 + - indicates whether to use AES encryption
1739 1797  
1740   -For 256-bit only
1741   - - ``--force-R5``: forces use of deprecated ``R=5`` encryption algorithm
  1798 + - - ``--force-V4``
  1799 + - forces use of V=4 encryption handler
1742 1800  
1743   - - ``--allow-insecure``: allow user password with empty owner password
  1801 +.. list-table:: Options for 256-bit Encryption Only
  1802 + :widths: 30 70
  1803 + :header-rows: 0
1744 1804  
1745   -Values for :samp:`{print-opt}`
1746   - - ``none``: disallow printing
  1805 + - - ``--force-R5``
  1806 + - forces use of deprecated ``R=5`` encryption algorithm
1747 1807  
1748   - - ``low``: allow only low-resolution printing
  1808 + - - ``--allow-insecure``
  1809 + - allow user password with empty owner password
1749 1810  
1750   - - ``full``: allow full printing
  1811 +.. list-table:: Values for :samp:`{print-opt}`
  1812 + :widths: 20 80
  1813 + :header-rows: 0
1751 1814  
1752   -Values for :samp:`{modify-opt}`
1753   - - ``none``: allow no modifications
  1815 + - - ``none``
  1816 + - disallow printing
1754 1817  
1755   - - ``assembly``: allow document assembly only
  1818 + - - ``low``
  1819 + - allow only low-resolution printing
1756 1820  
1757   - - ``form``: ``assembly`` permissions plus filling in form fields and signing
  1821 + - - ``full``
  1822 + - allow full printing
1758 1823  
1759   - - ``annotate``: ``form`` permissions plus commenting and modifying forms
  1824 +.. list-table:: Values for :samp:`{modify-opt}`
  1825 + :widths: 20 80
  1826 + :header-rows: 0
1760 1827  
1761   - - ``all``: allow full document modification
  1828 + - - ``none``
  1829 + - allow no modifications
  1830 +
  1831 + - - ``assembly``
  1832 + - allow document assembly only
  1833 +
  1834 + - - ``form``
  1835 + - ``assembly`` permissions plus filling in form fields and
  1836 + signing
  1837 +
  1838 + - - ``annotate``
  1839 + - ``form`` permissions plus commenting and modifying forms
  1840 +
  1841 + - - ``all``
  1842 + - allow full document modification
1762 1843  
1763 1844 Related Options
1764 1845 ~~~~~~~~~~~~~~~
... ... @@ -1873,30 +1954,46 @@ Related Options
1873 1954 allow enabling and disabling levels of restriction in a manner
1874 1955 similar to how some PDF creation tools do it:
1875 1956  
1876   - - ``none``: allow no modifications
  1957 + .. list-table:: :samp:`{modify-opt}` for 128-bit and 256-bit Encryption
  1958 + :widths: 10 80
  1959 + :header-rows: 0
  1960 +
  1961 + - - ``none``
  1962 + - allow no modifications
  1963 +
  1964 + - - ``assembly``
  1965 + - allow document assembly only
1877 1966  
1878   - - ``assembly``: allow document assembly only
  1967 + - - ``form``
  1968 + - ``assembly`` permissions plus filling in form fields and
  1969 + signing
1879 1970  
1880   - - ``form``: ``assembly`` permissions plus filling in form fields
1881   - and signing
  1971 + - - ``annotate``
  1972 + - ``form`` permissions plus commenting and modifying forms
1882 1973  
1883   - - ``annotate``: ``form`` permissions plus commenting and modifying
1884   - forms
  1974 + - - ``all``
  1975 + - allow full document modification (the default)
1885 1976  
1886   - - ``all``: allow full document modification (the default)
  1977 + Modify options correspond to the more granular options as follows:
1887 1978  
1888   - :samp:`{modify-opt}` values map to other combinations of options as
1889   - follows:
  1979 + .. list-table:: Mapping :samp:`{modify-opt}` to Other Options
  1980 + :widths: 10 80
  1981 + :header-rows: 0
1890 1982  
1891   - - ``none``: same as ``--modify-other=n --annotate=n --form=n --assemble=n``
  1983 + - - ``none``
  1984 + - ``--modify-other=n --annotate=n --form=n --assemble=n``
1892 1985  
1893   - - ``assembly``: same as ``--modify-other=n --annotate=n --form=n``
  1986 + - - ``assembly``
  1987 + - ``--modify-other=n --annotate=n --form=n``
1894 1988  
1895   - - ``form``: same as ``--modify-other=n --annotate=n``
  1989 + - - ``form``
  1990 + - ``--modify-other=n --annotate=n``
1896 1991  
1897   - - ``annotate``: same as ``--modify-other=n``
  1992 + - - ``annotate``
  1993 + - ``--modify-other=n``
1898 1994  
1899   - - ``all``: the default
  1995 + - - ``all``
  1996 + - no other modify options (the default)
1900 1997  
1901 1998 You can combine this option with the options listed above. If you
1902 1999 do, later options override earlier options.
... ... @@ -1919,11 +2016,18 @@ Related Options
1919 2016 printing. For 128-bit and 256-bit encryption, :samp:`{print-opt}`
1920 2017 may have the following values:
1921 2018  
1922   - - :samp:`none`: disallow printing
  2019 + .. list-table:: :samp:`{print-opt}` Values
  2020 + :widths: 10 80
  2021 + :header-rows: 0
1923 2022  
1924   - - :samp:`low`: allow low-resolution printing only
  2023 + - - :samp:`none`
  2024 + - disallow printing
1925 2025  
1926   - - :samp:`full`: allow full printing (the default)
  2026 + - - :samp:`low`
  2027 + - allow low-resolution printing only
  2028 +
  2029 + - - :samp:`full`
  2030 + - allow full printing (the default)
1927 2031  
1928 2032 .. qpdf:option:: --cleartext-metadata
1929 2033  
... ... @@ -2505,10 +2609,15 @@ indicate how far after. For example, US Eastern Standard Time
2505 2609 (America/New_York) is ``-05'00'``, and Indian Standard Time
2506 2610 (Asia/Calcutta) is ``+05'30'``.
2507 2611  
2508   -Examples:
2509   - - ``D:20210207161528-05'00'``: February 7, 2021 at 4:15:28 p.m.
  2612 +.. list-table:: PDF Date Examples
  2613 + :widths: 30 70
  2614 + :header-rows: 0
  2615 +
  2616 + - - ``D:20210207161528-05'00'``
  2617 + - February 7, 2021 at 4:15:28 p.m.
2510 2618  
2511   - - ``D:20210207211528Z``: February 7, 2021 at 21:15:28 UTC
  2619 + - - ``D:20210207211528Z``
  2620 + - February 7, 2021 at 21:15:28 UTC
2512 2621  
2513 2622 .. _add-attachment:
2514 2623  
... ... @@ -2670,11 +2779,18 @@ Related Options
2670 2779  
2671 2780 Silently exit with a code indicating the file's encryption status:
2672 2781  
2673   - - ``0``: the file is encrypted
  2782 + .. list-table:: Exit Codes for ``--is-encrypted``
  2783 + :widths: 5 80
  2784 + :header-rows: 0
  2785 +
  2786 + - - ``0``
  2787 + - the file is encrypted
2674 2788  
2675   - - ``1``: not used
  2789 + - - ``1``
  2790 + - not used
2676 2791  
2677   - - ``2``: the file is not encrypted
  2792 + - - ``2``
  2793 + - the file is not encrypted
2678 2794  
2679 2795 This option can be used for password-protected files even if you
2680 2796 don't know the password.
... ... @@ -2698,14 +2814,22 @@ Related Options
2698 2814  
2699 2815 Silently exit with a code indicating the file's password status:
2700 2816  
2701   - - ``0``: a password, other than as supplied, is required
  2817 + .. list-table:: Exit Codes for ``--requires-password``
  2818 + :widths: 5 80
  2819 + :header-rows: 0
2702 2820  
2703   - - ``1``: not used
  2821 + - - ``0``
  2822 + - a password, other than as supplied, is required
2704 2823  
2705   - - ``2``: the file is not encrypted
  2824 + - - ``1``
  2825 + - not used
2706 2826  
2707   - - ``3``: the file is encrypted, and correct password (if any) has
2708   - been supplied
  2827 + - - ``2``
  2828 + - the file is not encrypted
  2829 +
  2830 + - - ``3``
  2831 + - the file is encrypted, and correct password (if any) has
  2832 + been supplied
2709 2833  
2710 2834 Use with the :qpdf:ref:`--password` option to specify the password
2711 2835 to test.
... ... @@ -2738,7 +2862,7 @@ Related Options
2738 2862 standard output. Note that qpdf does not perform any validation
2739 2863 of the actual PDF page content or semantic correctness of the
2740 2864 PDF file. It merely checks that the PDF file is syntactically
2741   - valid.
  2865 + valid. See also qpdf --help=exit-status.
2742 2866  
2743 2867 Check the file's structure and well as encryption, linearization,
2744 2868 and encoding of stream data, and write information about the file
... ... @@ -2764,6 +2888,8 @@ Related Options
2764 2888 other options in this way can be useful for manually recovering
2765 2889 severely damaged files.
2766 2890  
  2891 + See also :ref:`exit-status`.
  2892 +
2767 2893 .. qpdf:option:: --show-encryption
2768 2894  
2769 2895 .. help: information about encrypted files
... ...