Commit 7097f290190885bdcae00ed175be6ea2346e9de8

Authored by Jay Berkenbilt
1 parent 0e909bab

More editorial changes from m-holger + spell check

cSpell.json
@@ -11,7 +11,6 @@ @@ -11,7 +11,6 @@
11 "afdh", 11 "afdh",
12 "afdhph", 12 "afdhph",
13 "ageneration", 13 "ageneration",
14 - "agogo",  
15 "aitems", 14 "aitems",
16 "annots", 15 "annots",
17 "aobjid", 16 "aobjid",
@@ -64,6 +63,7 @@ @@ -64,6 +63,7 @@
64 "coldwind", 63 "coldwind",
65 "colorspace", 64 "colorspace",
66 "conftest", 65 "conftest",
  66 + "copiable",
67 "cout", 67 "cout",
68 "cphe", 68 "cphe",
69 "cppflags", 69 "cppflags",
@@ -71,6 +71,7 @@ @@ -71,6 +71,7 @@
71 "cregex", 71 "cregex",
72 "crnl", 72 "crnl",
73 "csoe", 73 "csoe",
  74 + "cstr",
74 "cxxflags", 75 "cxxflags",
75 "cygwin", 76 "cygwin",
76 "dctdecode", 77 "dctdecode",
@@ -354,6 +355,7 @@ @@ -354,6 +355,7 @@
354 "qpdfsystemerror", 355 "qpdfsystemerror",
355 "qpdftokenizer", 356 "qpdftokenizer",
356 "qpdftypes", 357 "qpdftypes",
  358 + "qpdfusage",
357 "qpdfwriter", 359 "qpdfwriter",
358 "qpdfx", 360 "qpdfx",
359 "qpdfxrefentry", 361 "qpdfxrefentry",
job.sums
@@ -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 30dd97f36c6cd748fc53fcb8d864140e32274437ffdf12f609ed04150ad61858 11 +libqpdf/qpdf/auto_job_help.hh 7155be7c3212afb9d5033dfacd3456768931bb6e837a2079d2332cd5bdafa087
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 1cf74ad0956e51e919287f9dc93574764510856f562333a195775407551958a2 15 +manual/cli.rst 5fd018a6b34cd1b42a278f7b9afef709b72f082a65a563e8d2d3e10ce8ebe31a
libqpdf/JSON.cc
@@ -880,6 +880,7 @@ void JSONParser::getToken() @@ -880,6 +880,7 @@ void JSONParser::getToken()
880 break; 880 break;
881 881
882 case ls_backslash: 882 case ls_backslash:
  883 + /* cSpell: ignore bfnrt */
883 if (strchr("\\\"bfnrt", *p)) 884 if (strchr("\\\"bfnrt", *p))
884 { 885 {
885 lex_state = ls_string; 886 lex_state = ls_string;
@@ -972,7 +973,7 @@ JSONParser::handleToken() @@ -972,7 +973,7 @@ JSONParser::handleToken()
972 } 973 }
973 974
974 // Git string value 975 // Git string value
975 - std::string svalue; 976 + std::string s_value;
976 if (lex_state == ls_string) 977 if (lex_state == ls_string)
977 { 978 {
978 // Token includes the quotation marks 979 // Token includes the quotation marks
@@ -980,7 +981,7 @@ JSONParser::handleToken() @@ -980,7 +981,7 @@ JSONParser::handleToken()
980 { 981 {
981 throw std::logic_error("JSON string length < 2"); 982 throw std::logic_error("JSON string length < 2");
982 } 983 }
983 - svalue = decode_string(value); 984 + s_value = decode_string(value);
984 } 985 }
985 // Based on the lexical state and value, figure out whether we are 986 // Based on the lexical state and value, figure out whether we are
986 // looking at an item or a delimiter. It will always be exactly 987 // looking at an item or a delimiter. It will always be exactly
@@ -1057,7 +1058,7 @@ JSONParser::handleToken() @@ -1057,7 +1058,7 @@ JSONParser::handleToken()
1057 break; 1058 break;
1058 1059
1059 case ls_string: 1060 case ls_string:
1060 - item = new JSON(JSON::makeString(svalue)); 1061 + item = new JSON(JSON::makeString(s_value));
1061 break; 1062 break;
1062 1063
1063 case ls_backslash: 1064 case ls_backslash:
@@ -1223,7 +1224,7 @@ JSONParser::handleToken() @@ -1223,7 +1224,7 @@ JSONParser::handleToken()
1223 { 1224 {
1224 case ps_dict_begin: 1225 case ps_dict_begin:
1225 case ps_dict_after_comma: 1226 case ps_dict_after_comma:
1226 - this->dict_key = svalue; 1227 + this->dict_key = s_value;
1227 item = nullptr; 1228 item = nullptr;
1228 next_state = ps_dict_after_key; 1229 next_state = ps_dict_after_key;
1229 break; 1230 break;
@@ -1297,7 +1298,7 @@ JSONParser::parse(std::string const&amp; s) @@ -1297,7 +1298,7 @@ JSONParser::parse(std::string const&amp; s)
1297 } 1298 }
1298 if (parser_state != ps_done) 1299 if (parser_state != ps_done)
1299 { 1300 {
1300 - QTC::TC("libtests", "JSON parse preature EOF"); 1301 + QTC::TC("libtests", "JSON parse premature EOF");
1301 throw std::runtime_error("JSON: premature end of input"); 1302 throw std::runtime_error("JSON: premature end of input");
1302 } 1303 }
1303 return stack.back(); 1304 return stack.back();
libqpdf/JSONHandler.cc
@@ -88,20 +88,20 @@ JSONHandler::handle(std::string const&amp; path, JSON j) @@ -88,20 +88,20 @@ JSONHandler::handle(std::string const&amp; path, JSON j)
88 } 88 }
89 bool handled = false; 89 bool handled = false;
90 bool bvalue = false; 90 bool bvalue = false;
91 - std::string svalue; 91 + std::string s_value;
92 if (this->m->h.null_handler && j.isNull()) 92 if (this->m->h.null_handler && j.isNull())
93 { 93 {
94 this->m->h.null_handler(path); 94 this->m->h.null_handler(path);
95 handled = true; 95 handled = true;
96 } 96 }
97 - if (this->m->h.string_handler && j.getString(svalue)) 97 + if (this->m->h.string_handler && j.getString(s_value))
98 { 98 {
99 - this->m->h.string_handler(path, svalue); 99 + this->m->h.string_handler(path, s_value);
100 handled = true; 100 handled = true;
101 } 101 }
102 - if (this->m->h.number_handler && j.getNumber(svalue)) 102 + if (this->m->h.number_handler && j.getNumber(s_value))
103 { 103 {
104 - this->m->h.number_handler(path, svalue); 104 + this->m->h.number_handler(path, s_value);
105 handled = true; 105 handled = true;
106 } 106 }
107 if (this->m->h.bool_handler && j.getBool(bvalue)) 107 if (this->m->h.bool_handler && j.getBool(bvalue))
libqpdf/qpdf/auto_job_help.hh
@@ -328,9 +328,11 @@ ap.addOptionHelp(&quot;--underlay&quot;, &quot;modification&quot;, &quot;begin underlay options&quot;, R&quot;(--un @@ -328,9 +328,11 @@ ap.addOptionHelp(&quot;--underlay&quot;, &quot;modification&quot;, &quot;begin underlay options&quot;, R&quot;(--un
328 Underlay pages from another file on the output. 328 Underlay pages from another file on the output.
329 Run qpdf --help=overlay-underlay for details. 329 Run qpdf --help=overlay-underlay for details.
330 )"); 330 )");
331 -ap.addOptionHelp("--flatten-rotation", "modification", "remove rotation from page dictionary", R"(Rotate a page using content commands instead of page-level  
332 -metadata. This can be useful if a broken PDF viewer fails to  
333 -properly consider page rotation metadata. 331 +ap.addOptionHelp("--flatten-rotation", "modification", "remove rotation from page dictionary", R"(For each page that is rotated using the /Rotate key in the
  332 +page's dictionary, remove the /Rotate key and implement the
  333 +identical rotation semantics by modifying the page's contents.
  334 +This can be useful if a broken PDF viewer fails to properly
  335 +consider page rotation metadata.
334 )"); 336 )");
335 ap.addOptionHelp("--flatten-annotations", "modification", "push annotations into content", R"(--flatten-annotations=parameter 337 ap.addOptionHelp("--flatten-annotations", "modification", "push annotations into content", R"(--flatten-annotations=parameter
336 338
@@ -360,8 +362,6 @@ options: @@ -360,8 +362,6 @@ options:
360 --oi-min-height 362 --oi-min-height
361 --oi-min-area 363 --oi-min-area
362 --keep-inline-images 364 --keep-inline-images
363 -  
364 -The --verbose flag is useful with this option.  
365 )"); 365 )");
366 ap.addOptionHelp("--oi-min-width", "modification", "minimum width for --optimize-images", R"(--oi-min-width=width 366 ap.addOptionHelp("--oi-min-width", "modification", "minimum width for --optimize-images", R"(--oi-min-width=width
367 367
@@ -616,35 +616,25 @@ for help with the page range syntax. @@ -616,35 +616,25 @@ for help with the page range syntax.
616 ap.addHelpTopic("attachments", "work with embedded files", R"(It is possible to list, add, or delete embedded files (also known 616 ap.addHelpTopic("attachments", "work with embedded files", R"(It is possible to list, add, or delete embedded files (also known
617 as attachments) and to copy attachments from other files. See help 617 as attachments) and to copy attachments from other files. See help
618 on individual options for details. Run qpdf --help=add-attachment 618 on individual options for details. Run qpdf --help=add-attachment
619 -for additional details about adding attachments.  
620 -)");  
621 -ap.addOptionHelp("--list-attachments", "attachments", "list embedded files", R"(Show the key and stream number for each embedded file. Combine  
622 -with --verbose for more detailed information. 619 +for additional details about adding attachments. See also
  620 +--help=--list-attachments and --help=--show-attachment.
623 )"); 621 )");
624 -ap.addOptionHelp("--show-attachment", "attachments", "export an embedded file", R"(--show-attachment=key  
625 -  
626 -Write the contents of the specified attachment to standard  
627 -output as binary data. Get the key with --list-attachments.  
628 -)");  
629 -ap.addOptionHelp("--add-attachment", "attachments", "start add attachment options", R"(--add-attachment file options -- 622 +ap.addOptionHelp("--add-attachment", "attachments", "start add attachment options", R"(--add-attachment file [options] --
630 623
631 The --add-attachment flag and its options may be repeated to add 624 The --add-attachment flag and its options may be repeated to add
632 multiple attachments. Run qpdf --help=add-attachment for details. 625 multiple attachments. Run qpdf --help=add-attachment for details.
633 )"); 626 )");
634 -ap.addOptionHelp("--remove-attachment", "attachments", "remove an embedded file", R"(--remove-attachment=key  
635 -  
636 -Remove an embedded file using its key. Get the key with  
637 ---list-attachments.  
638 -)");  
639 -}  
640 -static void add_help_6(QPDFArgParser& ap)  
641 -{  
642 -ap.addOptionHelp("--copy-attachments-from", "attachments", "start copy attachment options", R"(--copy-attachments-from file options -- 627 +ap.addOptionHelp("--copy-attachments-from", "attachments", "start copy attachment options", R"(--copy-attachments-from file [options] --
643 628
644 The --copy-attachments-from flag and its options may be repeated 629 The --copy-attachments-from flag and its options may be repeated
645 to copy attachments from multiple files. Run 630 to copy attachments from multiple files. Run
646 qpdf --help=copy-attachments for details. 631 qpdf --help=copy-attachments for details.
647 )"); 632 )");
  633 +ap.addOptionHelp("--remove-attachment", "attachments", "remove an embedded file", R"(--remove-attachment=key
  634 +
  635 +Remove an embedded file using its key. Get the key with
  636 +--list-attachments.
  637 +)");
648 ap.addHelpTopic("pdf-dates", "PDF date format", R"(When a date is required, the date should conform to the PDF date 638 ap.addHelpTopic("pdf-dates", "PDF date format", R"(When a date is required, the date should conform to the PDF date
649 format specification, which is "D:yyyymmddhhmmssz" where "z" is 639 format specification, which is "D:yyyymmddhhmmssz" where "z" is
650 either literally upper case "Z" for UTC or a timezone offset in 640 either literally upper case "Z" for UTC or a timezone offset in
@@ -657,21 +647,24 @@ Examples: @@ -657,21 +647,24 @@ Examples:
657 - D:20210207161528-05'00' February 7, 2021 at 4:15:28 p.m. 647 - D:20210207161528-05'00' February 7, 2021 at 4:15:28 p.m.
658 - D:20210207211528Z February 7, 2021 at 21:15:28 UTC 648 - D:20210207211528Z February 7, 2021 at 21:15:28 UTC
659 )"); 649 )");
  650 +}
  651 +static void add_help_6(QPDFArgParser& ap)
  652 +{
660 ap.addHelpTopic("add-attachment", "attach (embed) files", R"(The options listed below appear between --add-attachment and its 653 ap.addHelpTopic("add-attachment", "attach (embed) files", R"(The options listed below appear between --add-attachment and its
661 terminating "--". 654 terminating "--".
662 )"); 655 )");
663 ap.addOptionHelp("--key", "add-attachment", "specify attachment key", R"(--key=key 656 ap.addOptionHelp("--key", "add-attachment", "specify attachment key", R"(--key=key
664 657
665 Specify the key to use for the attachment in the embedded files 658 Specify the key to use for the attachment in the embedded files
666 -table. It defaults to the last element of the attached file's  
667 -filename. 659 +table. It defaults to the last element (basename) of the
  660 +attached file's filename.
668 )"); 661 )");
669 ap.addOptionHelp("--filename", "add-attachment", "set attachment's displayed filename", R"(--filename=name 662 ap.addOptionHelp("--filename", "add-attachment", "set attachment's displayed filename", R"(--filename=name
670 663
671 Specify the filename to be used for the attachment. This is what 664 Specify the filename to be used for the attachment. This is what
672 is usually displayed to the user and is the name most graphical 665 is usually displayed to the user and is the name most graphical
673 PDF viewers will use when saving a file. It defaults to the last 666 PDF viewers will use when saving a file. It defaults to the last
674 -element of the attached file's filename. 667 +element (basename) of the attached file's filename.
675 )"); 668 )");
676 ap.addOptionHelp("--creationdate", "add-attachment", "set attachment's creation date", R"(--creationdate=date 669 ap.addOptionHelp("--creationdate", "add-attachment", "set attachment's creation date", R"(--creationdate=date
677 670
@@ -712,7 +705,7 @@ duplicate attachment keys. This affects the key only, not the @@ -712,7 +705,7 @@ duplicate attachment keys. This affects the key only, not the
712 file name. 705 file name.
713 )"); 706 )");
714 ap.addHelpTopic("inspection", "inspect PDF files", R"(These options provide tools for inspecting PDF files. When any of 707 ap.addHelpTopic("inspection", "inspect PDF files", R"(These options provide tools for inspecting PDF files. When any of
715 -the options in this section are specified, no output file should be 708 +the options in this section are specified, no output file may be
716 given. 709 given.
717 )"); 710 )");
718 ap.addOptionHelp("--is-encrypted", "inspection", "silently test whether a file is encrypted", R"(Silently exit with a code indicating the file's encryption status: 711 ap.addOptionHelp("--is-encrypted", "inspection", "silently test whether a file is encrypted", R"(Silently exit with a code indicating the file's encryption status:
@@ -743,15 +736,12 @@ user password if the owner password is given and the file was @@ -743,15 +736,12 @@ user password if the owner password is given and the file was
743 encrypted using older encryption formats that allow user 736 encrypted using older encryption formats that allow user
744 password recovery. 737 password recovery.
745 )"); 738 )");
746 -ap.addOptionHelp("--show-encryption-key", "inspection", "show key with --show-encryption", R"(When used with --show-encryption, causes the underlying  
747 -encryption key to be displayed. 739 +ap.addOptionHelp("--show-encryption-key", "inspection", "show key with --show-encryption", R"(When used with --show-encryption or --check, causes the
  740 +underlying encryption key to be displayed.
748 )"); 741 )");
749 ap.addOptionHelp("--check-linearization", "inspection", "check linearization tables", R"(Check to see whether a file is linearized and, if so, whether 742 ap.addOptionHelp("--check-linearization", "inspection", "check linearization tables", R"(Check to see whether a file is linearized and, if so, whether
750 the linearization hint tables are correct. 743 the linearization hint tables are correct.
751 )"); 744 )");
752 -}  
753 -static void add_help_7(QPDFArgParser& ap)  
754 -{  
755 ap.addOptionHelp("--show-linearization", "inspection", "show linearization hint tables", R"(Check and display all data in the linearization hint tables. 745 ap.addOptionHelp("--show-linearization", "inspection", "show linearization hint tables", R"(Check and display all data in the linearization hint tables.
756 )"); 746 )");
757 ap.addOptionHelp("--show-xref", "inspection", "show cross reference data", R"(Show the contents of the cross-reference table or stream (object 747 ap.addOptionHelp("--show-xref", "inspection", "show cross reference data", R"(Show the contents of the cross-reference table or stream (object
@@ -759,7 +749,10 @@ locations in the file) in a human-readable form. This is @@ -759,7 +749,10 @@ locations in the file) in a human-readable form. This is
759 especially useful for files with cross-reference streams, which 749 especially useful for files with cross-reference streams, which
760 are stored in a binary format. 750 are stored in a binary format.
761 )"); 751 )");
762 -ap.addOptionHelp("--show-object", "inspection", "show contents of an object", R"(--show-object=trailer|obj[,gen] 752 +}
  753 +static void add_help_7(QPDFArgParser& ap)
  754 +{
  755 +ap.addOptionHelp("--show-object", "inspection", "show contents of an object", R"(--show-object={trailer|obj[,gen]}
763 756
764 Show the contents of the given object. This is especially useful 757 Show the contents of the given object. This is especially useful
765 for inspecting objects that are inside of object streams (also 758 for inspecting objects that are inside of object streams (also
@@ -784,6 +777,14 @@ object and for each content stream associated with the page. @@ -784,6 +777,14 @@ object and for each content stream associated with the page.
784 ap.addOptionHelp("--with-images", "inspection", "include image details with --show-pages", R"(When used with --show-pages, also shows the object and 777 ap.addOptionHelp("--with-images", "inspection", "include image details with --show-pages", R"(When used with --show-pages, also shows the object and
785 generation numbers for the image objects on each page. 778 generation numbers for the image objects on each page.
786 )"); 779 )");
  780 +ap.addOptionHelp("--list-attachments", "inspection", "list embedded files", R"(Show the key and stream number for each embedded file. Combine
  781 +with --verbose for more detailed information.
  782 +)");
  783 +ap.addOptionHelp("--show-attachment", "inspection", "export an embedded file", R"(--show-attachment=key
  784 +
  785 +Write the contents of the specified attachment to standard
  786 +output as binary data. Get the key with --list-attachments.
  787 +)");
787 ap.addHelpTopic("json", "JSON output for PDF information", R"(Show information about the PDF file in JSON format. Please see the 788 ap.addHelpTopic("json", "JSON output for PDF information", R"(Show information about the PDF file in JSON format. Please see the
788 JSON chapter in the qpdf manual for details. 789 JSON chapter in the qpdf manual for details.
789 )"); 790 )");
@@ -798,7 +799,7 @@ This option is repeatable. If given, only the specified @@ -798,7 +799,7 @@ This option is repeatable. If given, only the specified
798 top-level keys will be included in the JSON output. Otherwise, 799 top-level keys will be included in the JSON output. Otherwise,
799 all keys will be included. 800 all keys will be included.
800 )"); 801 )");
801 -ap.addOptionHelp("--json-object", "json", "restrict which objects are in JSON", R"(--json-object=trailer|obj[,gen] 802 +ap.addOptionHelp("--json-object", "json", "restrict which objects are in JSON", R"(--json-object={trailer|obj[,gen]}
802 803
803 This option is repeatable. If given, only specified objects will 804 This option is repeatable. If given, only specified objects will
804 be shown in the "objects" key of the JSON output. Otherwise, all 805 be shown in the "objects" key of the JSON output. Otherwise, all
libtests/json.cc
@@ -29,6 +29,7 @@ static void test_main() @@ -29,6 +29,7 @@ static void test_main()
29 assert(jstr2.getString(value)); 29 assert(jstr2.getString(value));
30 assert(value == "a\tb"); 30 assert(value == "a\tb");
31 assert(! jstr2.getNumber(value)); 31 assert(! jstr2.getNumber(value));
  32 + /* cSpell: ignore jbool xavalue dvalue xdvalue */
32 JSON jint = JSON::makeInt(16059); 33 JSON jint = JSON::makeInt(16059);
33 JSON jdouble = JSON::makeReal(3.14159); 34 JSON jdouble = JSON::makeReal(3.14159);
34 JSON jexp = JSON::makeNumber("2.1e5"); 35 JSON jexp = JSON::makeNumber("2.1e5");
@@ -128,6 +129,7 @@ static void check_schema(JSON&amp; obj, JSON&amp; schema, unsigned long flags, @@ -128,6 +129,7 @@ static void check_schema(JSON&amp; obj, JSON&amp; schema, unsigned long flags,
128 129
129 static void test_schema() 130 static void test_schema()
130 { 131 {
  132 + /* cSpell: ignore ptional ebra */
131 JSON schema = JSON::parse(R"( 133 JSON schema = JSON::parse(R"(
132 { 134 {
133 "one": { 135 "one": {
libtests/json_handler.cc
@@ -99,6 +99,7 @@ static void test_all() @@ -99,6 +99,7 @@ static void test_all()
99 { 99 {
100 std::cout << "-- all --" << std::endl; 100 std::cout << "-- all --" << std::endl;
101 auto h = make_all_handler(); 101 auto h = make_all_handler();
  102 + /* cSpell: ignore phour */
102 JSON j = JSON::parse(R"({ 103 JSON j = JSON::parse(R"({
103 "one": "potato", 104 "one": "potato",
104 "two": 3.14, 105 "two": 3.14,
libtests/libtests.testcov
@@ -70,7 +70,7 @@ JSON parse unexpected } 0 @@ -70,7 +70,7 @@ JSON parse unexpected } 0
70 JSON parse unexpected ] 0 70 JSON parse unexpected ] 0
71 JSON parse unexpected : 0 71 JSON parse unexpected : 0
72 JSON parse unexpected , 0 72 JSON parse unexpected , 0
73 -JSON parse preature EOF 0 73 +JSON parse premature EOF 0
74 JSON parse null character 0 74 JSON parse null character 0
75 JSON parse bad character 0 75 JSON parse bad character 0
76 JSON parse point after e 0 76 JSON parse point after e 0
manual/cli.rst
@@ -109,9 +109,10 @@ Password-protected files may be opened by specifying a password with @@ -109,9 +109,10 @@ Password-protected files may be opened by specifying a password with
109 :qpdf:ref:`--password`. 109 :qpdf:ref:`--password`.
110 110
111 All options other than help options (see :ref:`help-options`) require 111 All options other than help options (see :ref:`help-options`) require
112 -an input file. If inspection options (see :ref:`inspection-options`)  
113 -or help options are given, an output file must not be given. Otherwise,  
114 -an output file is required. 112 +an input file. If inspection or JSON options (see
  113 +:ref:`inspection-options` and :ref:`json-options`) or help options are
  114 +given, an output file must not be given. Otherwise, an output file is
  115 +required.
115 116
116 If :samp:`@filename` appears as a word anywhere in the command-line, 117 If :samp:`@filename` appears as a word anywhere in the command-line,
117 it will be read line by line, and each line will be treated as a 118 it will be read line by line, and each line will be treated as a
@@ -246,9 +247,9 @@ Shell Completion @@ -246,9 +247,9 @@ Shell Completion
246 You can enable bash completion with :command:`eval $(qpdf 247 You can enable bash completion with :command:`eval $(qpdf
247 --completion-bash)` and zsh completion with :command:`eval $(qpdf 248 --completion-bash)` and zsh completion with :command:`eval $(qpdf
248 --completion-zsh)`. If :command:`qpdf` is not in your path, you should 249 --completion-zsh)`. If :command:`qpdf` is not in your path, you should
249 -invoke it above with an absolute path. If you invoke it with a  
250 -relative path, it will warn you, and the completion won't work if  
251 -you're in a different directory. 250 +use an absolute path to qpdf in the above invocation. If you invoke it
  251 +with a relative path, it will warn you, and the completion won't work
  252 +if you're in a different directory.
252 253
253 :command:`qpdf` will use ``argv[0]`` to figure out where its 254 :command:`qpdf` will use ``argv[0]`` to figure out where its
254 executable is. This may produce unwanted results in some cases, 255 executable is. This may produce unwanted results in some cases,
@@ -1439,9 +1440,11 @@ Related Options @@ -1439,9 +1440,11 @@ Related Options
1439 1440
1440 .. help: remove rotation from page dictionary 1441 .. help: remove rotation from page dictionary
1441 1442
1442 - Rotate a page using content commands instead of page-level  
1443 - metadata. This can be useful if a broken PDF viewer fails to  
1444 - properly consider page rotation metadata. 1443 + For each page that is rotated using the /Rotate key in the
  1444 + page's dictionary, remove the /Rotate key and implement the
  1445 + identical rotation semantics by modifying the page's contents.
  1446 + This can be useful if a broken PDF viewer fails to properly
  1447 + consider page rotation metadata.
1445 1448
1446 For each page that is rotated using the ``/Rotate`` key in the 1449 For each page that is rotated using the ``/Rotate`` key in the
1447 page's dictionary, remove the ``/Rotate`` key and implement the 1450 page's dictionary, remove the ``/Rotate`` key and implement the
@@ -1564,7 +1567,7 @@ Related Options @@ -1564,7 +1567,7 @@ Related Options
1564 If a file contains interactive form fields and indicates that the 1567 If a file contains interactive form fields and indicates that the
1565 appearances are out of date with the values of the form, this flag 1568 appearances are out of date with the values of the form, this flag
1566 will regenerate appearances, subject to a few limitations. Note 1569 will regenerate appearances, subject to a few limitations. Note
1567 - that there is not usually a reason to do this, but it can be 1570 + that there is usually no reason to do this, but it can be
1568 necessary before using the :qpdf:ref:`--flatten-annotations` 1571 necessary before using the :qpdf:ref:`--flatten-annotations`
1569 option. Here is a summary of the limitations. 1572 option. Here is a summary of the limitations.
1570 1573
@@ -1614,8 +1617,6 @@ Related Options @@ -1614,8 +1617,6 @@ Related Options
1614 --oi-min-area 1617 --oi-min-area
1615 --keep-inline-images 1618 --keep-inline-images
1616 1619
1617 - The --verbose flag is useful with this option.  
1618 -  
1619 This flag causes qpdf to recompress all images that are not 1620 This flag causes qpdf to recompress all images that are not
1620 compressed with DCT (JPEG) using DCT compression as long as doing 1621 compressed with DCT (JPEG) using DCT compression as long as doing
1621 so decreases the size in bytes of the image data and the image does 1622 so decreases the size in bytes of the image data and the image does
@@ -1661,9 +1662,8 @@ Related Options @@ -1661,9 +1662,8 @@ Related Options
1661 1662
1662 Prevent inline images from being considered by --optimize-images. 1663 Prevent inline images from being considered by --optimize-images.
1663 1664
1664 - Prevent inline images from being included in image optimization.  
1665 - This option has no effect when :qpdf:ref:`--optimize-images` is not  
1666 - specified. 1665 + Prevent inline images from being included in image optimization
  1666 + done by :qpdf:ref:`--optimize-images`.
1667 1667
1668 .. qpdf:option:: --remove-page-labels 1668 .. qpdf:option:: --remove-page-labels
1669 1669
@@ -1901,12 +1901,12 @@ Related Options @@ -1901,12 +1901,12 @@ Related Options
1901 encryption. 1901 encryption.
1902 1902
1903 Enable/disable extraction of text for accessibility to visually 1903 Enable/disable extraction of text for accessibility to visually
1904 - impaired users. The qpdf library disregards this field when AES is used  
1905 - with 128-bit encryption or when 256-bit encryption is used. You  
1906 - should never disable accessibility unless you are explicitly doing  
1907 - so for creating test files. The PDF spec says that conforming  
1908 - readers should disregard this permission and always allow  
1909 - accessibility. 1904 + impaired users. The default is to be fully permissive. The qpdf
  1905 + library disregards this field when AES is used with 128-bit
  1906 + encryption or when 256-bit encryption is used. You should never
  1907 + disable accessibility unless you are explicitly doing so for
  1908 + creating test files. The PDF spec says that conforming readers
  1909 + should disregard this permission and always allow accessibility.
1910 1910
1911 This option is not available with 40-bit encryption. 1911 This option is not available with 40-bit encryption.
1912 1912
@@ -1920,10 +1920,10 @@ Related Options @@ -1920,10 +1920,10 @@ Related Options
1920 unless --modify-other=n or --modify=none is also specified. 1920 unless --modify-other=n or --modify=none is also specified.
1921 1921
1922 Enable/disable modifying annotations including making comments and 1922 Enable/disable modifying annotations including making comments and
1923 - filling in form fields. For 128-bit and 256-bit encryption, this  
1924 - also enables editing, creating, and deleting form fields unless  
1925 - :samp:`--modify-other=n` or :samp:`--modify=none` is also  
1926 - specified. 1923 + filling in form fields. The default is to be fully permissive. For
  1924 + 128-bit and 256-bit encryption, this also enables editing,
  1925 + creating, and deleting form fields unless :samp:`--modify-other=n`
  1926 + or :samp:`--modify=none` is also specified.
1927 1927
1928 .. qpdf:option:: --assemble=[yn] 1928 .. qpdf:option:: --assemble=[yn]
1929 1929
@@ -1933,7 +1933,7 @@ Related Options @@ -1933,7 +1933,7 @@ Related Options
1933 pages). This option is not available with 40-bit encryption. 1933 pages). This option is not available with 40-bit encryption.
1934 1934
1935 Enable/disable document assembly (rotation and reordering of 1935 Enable/disable document assembly (rotation and reordering of
1936 - pages). 1936 + pages). The default is to be fully permissive.
1937 1937
1938 This option is not available with 40-bit encryption. 1938 This option is not available with 40-bit encryption.
1939 1939
@@ -1945,7 +1945,7 @@ Related Options @@ -1945,7 +1945,7 @@ Related Options
1945 accessibility. 1945 accessibility.
1946 1946
1947 Enable/disable text/graphic extraction for purposes other than 1947 Enable/disable text/graphic extraction for purposes other than
1948 - accessibility. 1948 + accessibility. The default is to be fully permissive.
1949 1949
1950 .. qpdf:option:: --form=[yn] 1950 .. qpdf:option:: --form=[yn]
1951 1951
@@ -1956,7 +1956,8 @@ Related Options @@ -1956,7 +1956,8 @@ Related Options
1956 available with 40-bit encryption. 1956 available with 40-bit encryption.
1957 1957
1958 Enable/disable whether filling form fields is allowed even if 1958 Enable/disable whether filling form fields is allowed even if
1959 - modification of annotations is disabled. 1959 + modification of annotations is disabled. The default is to be fully
  1960 + permissive.
1960 1961
1961 This option is not available with 40-bit encryption. 1962 This option is not available with 40-bit encryption.
1962 1963
@@ -1972,7 +1973,8 @@ Related Options @@ -1972,7 +1973,8 @@ Related Options
1972 Enable/disable modifications not controlled by 1973 Enable/disable modifications not controlled by
1973 :qpdf:ref:`--assemble`, :qpdf:ref:`--annotate`, or 1974 :qpdf:ref:`--assemble`, :qpdf:ref:`--annotate`, or
1974 :qpdf:ref:`--form`. ``--modify-other=n`` is implied by any of the 1975 :qpdf:ref:`--form`. ``--modify-other=n`` is implied by any of the
1975 - other :qpdf:ref:`--modify` options except for ``--modify=all``. 1976 + other :qpdf:ref:`--modify` options except for ``--modify=all``. The
  1977 + default is to be fully permissive.
1976 1978
1977 This option is not available with 40-bit encryption. 1979 This option is not available with 40-bit encryption.
1978 1980
@@ -1995,7 +1997,8 @@ Related Options @@ -1995,7 +1997,8 @@ Related Options
1995 none: --modify-other=n --annotate=n --form=n --assemble=n 1997 none: --modify-other=n --annotate=n --form=n --assemble=n
1996 1998
1997 For 40-bit files, :samp:`{modify-opt}` may only be ``y`` or ``n`` 1999 For 40-bit files, :samp:`{modify-opt}` may only be ``y`` or ``n``
1998 - and controls all aspects of document modification. 2000 + and controls all aspects of document modification. The default is
  2001 + to be fully permissive.
1999 2002
2000 For 128-bit and 256-bit encryption, :samp:`{modify-opt}` values 2003 For 128-bit and 256-bit encryption, :samp:`{modify-opt}` values
2001 allow enabling and disabling levels of restriction in a manner 2004 allow enabling and disabling levels of restriction in a manner
@@ -2058,10 +2061,11 @@ Related Options @@ -2058,10 +2061,11 @@ Related Options
2058 low: allow low-resolution printing only 2061 low: allow low-resolution printing only
2059 full: allow full printing (the default) 2062 full: allow full printing (the default)
2060 2063
2061 - Control what kind of printing is allowed. For 40-bit encryption,  
2062 - :samp:`{print-opt}` may only be ``y`` or ``n`` and enables or disables all  
2063 - printing. For 128-bit and 256-bit encryption, :samp:`{print-opt}`  
2064 - may have the following values: 2064 + Control what kind of printing is allowed. The default is to be
  2065 + fully permissive. For 40-bit encryption, :samp:`{print-opt}` may
  2066 + only be ``y`` or ``n`` and enables or disables all printing. For
  2067 + 128-bit and 256-bit encryption, :samp:`{print-opt}` may have the
  2068 + following values:
2065 2069
2066 .. list-table:: :samp:`{print-opt}` Values 2070 .. list-table:: :samp:`{print-opt}` Values
2067 :widths: 10 80 2071 :widths: 10 80
@@ -2118,9 +2122,9 @@ Related Options @@ -2118,9 +2122,9 @@ Related Options
2118 created in this way are insecure since they can be opened without a 2122 created in this way are insecure since they can be opened without a
2119 password, and restrictions will not be enforced. Users would 2123 password, and restrictions will not be enforced. Users would
2120 ordinarily never want to create such files. If you are using qpdf 2124 ordinarily never want to create such files. If you are using qpdf
2121 - to intentionally created strange files for testing (a definite  
2122 - valid use of qpdf!), this option allows you to create such insecure  
2123 - files. This option is only available with 256-bit encryption. 2125 + to intentionally created strange files for testing (a valid use of
  2126 + qpdf!), this option allows you to create such insecure files. This
  2127 + option is only available with 256-bit encryption.
2124 2128
2125 See :ref:`pdf-passwords` for a more technical discussion of this 2129 See :ref:`pdf-passwords` for a more technical discussion of this
2126 issue. 2130 issue.
@@ -2262,7 +2266,7 @@ Examples @@ -2262,7 +2266,7 @@ Examples
2262 2266
2263 qpdf --empty --pages a.pdf b.pdf --password=x z-1 c.pdf 3,6 2267 qpdf --empty --pages a.pdf b.pdf --password=x z-1 c.pdf 3,6
2264 2268
2265 -- Scan a document with printing on both sides by scanning the fronts 2269 +- Scan a document with double-sided printing by scanning the fronts
2266 into :file:`odd.pdf` and the backs into :file:`even.pdf`. Collate 2270 into :file:`odd.pdf` and the backs into :file:`even.pdf`. Collate
2267 the results into :file:`all.pdf`. This takes the first page of 2271 the results into :file:`all.pdf`. This takes the first page of
2268 :file:`odd.pdf`, the first page of :file:`even.pdf`, the second page 2272 :file:`odd.pdf`, the first page of :file:`even.pdf`, the second page
@@ -2462,7 +2466,8 @@ output. The ``--overlay`` and ``--underlay`` options work the same @@ -2462,7 +2466,8 @@ output. The ``--overlay`` and ``--underlay`` options work the same
2462 way, except underlay pages are drawn underneath the page to which they 2466 way, except underlay pages are drawn underneath the page to which they
2463 are applied, possibly obscured by the original page, and overlay files 2467 are applied, possibly obscured by the original page, and overlay files
2464 are drawn on top of the page to which they are applied, possibly 2468 are drawn on top of the page to which they are applied, possibly
2465 -obscuring the page. You can combine overlay and underlay. 2469 +obscuring the page. You can combine overlay and underlay, but you can
  2470 +only specify each option at most one time.
2466 2471
2467 The default behavior of overlay and underlay is that pages are taken 2472 The default behavior of overlay and underlay is that pages are taken
2468 from the overlay/underlay file in sequence and applied to 2473 from the overlay/underlay file in sequence and applied to
@@ -2495,8 +2500,14 @@ and the ``--`` option. The following options are supported: @@ -2495,8 +2500,14 @@ and the ``--`` option. The following options are supported:
2495 2500
2496 Specify a page range that indicates which pages in the 2501 Specify a page range that indicates which pages in the
2497 overlay/underlay file will be used for overlay or underlay. If not 2502 overlay/underlay file will be used for overlay or underlay. If not
2498 -specified, all pages will be used. This can be left empty by omitting  
2499 -:samp:`{page-range}` if :qpdf:ref:`--repeat` is used. 2503 +specified, all pages will be used. The "from" pages are used until
  2504 +they are exhausted, after which any pages specified with
  2505 +:qpdf:ref:`--repeat` are used. If you are using the
  2506 +:qpdf:ref:`--repeat` option, you can use ``--from=`` to provide an
  2507 +empty set of "from" pages.
  2508 +
  2509 +This Can be left empty by omitting
  2510 +:samp:`{page-range}`
2500 2511
2501 .. qpdf:option:: --repeat=page-range 2512 .. qpdf:option:: --repeat=page-range
2502 2513
@@ -2549,40 +2560,17 @@ Embedded Files/Attachments @@ -2549,40 +2560,17 @@ Embedded Files/Attachments
2549 It is possible to list, add, or delete embedded files (also known 2560 It is possible to list, add, or delete embedded files (also known
2550 as attachments) and to copy attachments from other files. See help 2561 as attachments) and to copy attachments from other files. See help
2551 on individual options for details. Run qpdf --help=add-attachment 2562 on individual options for details. Run qpdf --help=add-attachment
2552 - for additional details about adding attachments. 2563 + for additional details about adding attachments. See also
  2564 + --help=--list-attachments and --help=--show-attachment.
2553 2565
2554 It is possible to list, add, or delete embedded files (also known as 2566 It is possible to list, add, or delete embedded files (also known as
2555 -attachments) and to copy attachments from other files. 2567 +attachments) and to copy attachments from other files. See also
  2568 +:qpdf:ref:`--list-attachments` and :qpdf:ref:`--show-attachment`.
2556 2569
2557 Related Options 2570 Related Options
2558 ~~~~~~~~~~~~~~~ 2571 ~~~~~~~~~~~~~~~
2559 2572
2560 -.. qpdf:option:: --list-attachments  
2561 -  
2562 - .. help: list embedded files  
2563 -  
2564 - Show the key and stream number for each embedded file. Combine  
2565 - with --verbose for more detailed information.  
2566 -  
2567 - Show the *key* and stream number for each embedded file. With  
2568 - :qpdf:ref:`--verbose`, additional information, including preferred  
2569 - file name, description, dates, and more are also displayed. The key  
2570 - is usually but not always equal to the file name and is needed by  
2571 - some of the other options.  
2572 -  
2573 -.. qpdf:option:: --show-attachment=key  
2574 -  
2575 - .. help: export an embedded file  
2576 -  
2577 - Write the contents of the specified attachment to standard  
2578 - output as binary data. Get the key with --list-attachments.  
2579 -  
2580 - Write the contents of the specified attachment to standard output  
2581 - as binary data. The key should match one of the keys shown by  
2582 - :qpdf:ref:`--list-attachments`. If this option is given more than  
2583 - once, only the last attachment will be shown.  
2584 -  
2585 -.. qpdf:option:: --add-attachment file options -- 2573 +.. qpdf:option:: --add-attachment file [options] --
2586 2574
2587 .. help: start add attachment options 2575 .. help: start add attachment options
2588 2576
@@ -2596,6 +2584,21 @@ Related Options @@ -2596,6 +2584,21 @@ Related Options
2596 add multiple attachments. Please see :ref:`add-attachment` for 2584 add multiple attachments. Please see :ref:`add-attachment` for
2597 additional details. 2585 additional details.
2598 2586
  2587 +.. qpdf:option:: --copy-attachments-from file [options] --
  2588 +
  2589 + .. help: start copy attachment options
  2590 +
  2591 + The --copy-attachments-from flag and its options may be repeated
  2592 + to copy attachments from multiple files. Run
  2593 + qpdf --help=copy-attachments for details.
  2594 +
  2595 + This flag starts copy attachment options, which are used to copy
  2596 + attachments from other files.
  2597 +
  2598 + The ``--copy-attachments-from`` flag and its options may be
  2599 + repeated to copy attachments from multiple files. Please see
  2600 + :ref:`copy-attachments` for additional details.
  2601 +
2599 .. qpdf:option:: --remove-attachment=key 2602 .. qpdf:option:: --remove-attachment=key
2600 2603
2601 .. help: remove an embedded file 2604 .. help: remove an embedded file
@@ -2612,21 +2615,6 @@ Related Options @@ -2612,21 +2615,6 @@ Related Options
2612 the attachment key. This option may be repeated to remove multiple 2615 the attachment key. This option may be repeated to remove multiple
2613 attachments. 2616 attachments.
2614 2617
2615 -.. qpdf:option:: --copy-attachments-from file options --  
2616 -  
2617 - .. help: start copy attachment options  
2618 -  
2619 - The --copy-attachments-from flag and its options may be repeated  
2620 - to copy attachments from multiple files. Run  
2621 - qpdf --help=copy-attachments for details.  
2622 -  
2623 - This flag starts copy attachment options, which are used to copy  
2624 - attachments from other files.  
2625 -  
2626 - The ``--copy-attachments-from`` flag and its options may be  
2627 - repeated to copy attachments from multiple files. Please see  
2628 - :ref:`copy-attachments` for additional details.  
2629 -  
2630 .. _pdf-dates: 2618 .. _pdf-dates:
2631 2619
2632 PDF Date Format 2620 PDF Date Format
@@ -2682,12 +2670,13 @@ These options are valid between :qpdf:ref:`--add-attachment` and ``--``. @@ -2682,12 +2670,13 @@ These options are valid between :qpdf:ref:`--add-attachment` and ``--``.
2682 .. help: specify attachment key 2670 .. help: specify attachment key
2683 2671
2684 Specify the key to use for the attachment in the embedded files 2672 Specify the key to use for the attachment in the embedded files
2685 - table. It defaults to the last element of the attached file's  
2686 - filename. 2673 + table. It defaults to the last element (basename) of the
  2674 + attached file's filename.
2687 2675
2688 Specify the key to use for the attachment in the embedded files 2676 Specify the key to use for the attachment in the embedded files
2689 table. It defaults to the last element of the attached file's 2677 table. It defaults to the last element of the attached file's
2690 - filename. 2678 + filename. For example, if you say ``--add-attachment
  2679 + /home/user/image.png``, the default key will be just ``image.png``.
2691 2680
2692 .. qpdf:option:: --filename=name 2681 .. qpdf:option:: --filename=name
2693 2682
@@ -2696,12 +2685,14 @@ These options are valid between :qpdf:ref:`--add-attachment` and ``--``. @@ -2696,12 +2685,14 @@ These options are valid between :qpdf:ref:`--add-attachment` and ``--``.
2696 Specify the filename to be used for the attachment. This is what 2685 Specify the filename to be used for the attachment. This is what
2697 is usually displayed to the user and is the name most graphical 2686 is usually displayed to the user and is the name most graphical
2698 PDF viewers will use when saving a file. It defaults to the last 2687 PDF viewers will use when saving a file. It defaults to the last
2699 - element of the attached file's filename. 2688 + element (basename) of the attached file's filename.
2700 2689
2701 Specify the filename to be used for the attachment. This is what is 2690 Specify the filename to be used for the attachment. This is what is
2702 usually displayed to the user and is the name most graphical PDF 2691 usually displayed to the user and is the name most graphical PDF
2703 viewers will use when saving a file. It defaults to the last 2692 viewers will use when saving a file. It defaults to the last
2704 - element of the attached file's filename. 2693 + element of the attached file's filename. For example, if you say
  2694 + ``--add-attachment /home/user/image.png``, the default key will be
  2695 + just ``image.png``.
2705 2696
2706 .. qpdf:option:: --creationdate=date 2697 .. qpdf:option:: --creationdate=date
2707 2698
@@ -2807,11 +2798,11 @@ PDF Inspection @@ -2807,11 +2798,11 @@ PDF Inspection
2807 .. help-topic inspection: inspect PDF files 2798 .. help-topic inspection: inspect PDF files
2808 2799
2809 These options provide tools for inspecting PDF files. When any of 2800 These options provide tools for inspecting PDF files. When any of
2810 - the options in this section are specified, no output file should be 2801 + the options in this section are specified, no output file may be
2811 given. 2802 given.
2812 2803
2813 These options provide tools for inspecting PDF files. When any of the 2804 These options provide tools for inspecting PDF files. When any of the
2814 -options in this section are specified, no output file should be given. 2805 +options in this section are specified, no output file may be given.
2815 2806
2816 Related Options 2807 Related Options
2817 ~~~~~~~~~~~~~~~ 2808 ~~~~~~~~~~~~~~~
@@ -2898,12 +2889,12 @@ Related Options @@ -2898,12 +2889,12 @@ Related Options
2898 If a password is supplied with :qpdf:ref:`--password`, that 2889 If a password is supplied with :qpdf:ref:`--password`, that
2899 password is used to open the file just as with any normal 2890 password is used to open the file just as with any normal
2900 invocation of :command:`qpdf`. That means that using this option 2891 invocation of :command:`qpdf`. That means that using this option
2901 - with :qpdf:ref:`--password` option can be used to check the  
2902 - correctness of the password. In that case, an exit status of ``3``  
2903 - means the file works with the supplied password. This option is  
2904 - mutually exclusive with :qpdf:ref:`--is-encrypted`. Both this  
2905 - option and :qpdf:ref:`--is-encrypted` exit with status ``2`` for  
2906 - non-encrypted files. 2892 + with :qpdf:ref:`--password` can be used to check the correctness of
  2893 + the password. In that case, an exit status of ``3`` means the file
  2894 + works with the supplied password. This option is mutually exclusive
  2895 + with :qpdf:ref:`--is-encrypted`. Both this option and
  2896 + :qpdf:ref:`--is-encrypted` exit with status ``2`` for non-encrypted
  2897 + files.
2907 2898
2908 .. qpdf:option:: --check 2899 .. qpdf:option:: --check
2909 2900
@@ -2962,8 +2953,8 @@ Related Options @@ -2962,8 +2953,8 @@ Related Options
2962 2953
2963 .. help: show key with --show-encryption 2954 .. help: show key with --show-encryption
2964 2955
2965 - When used with --show-encryption, causes the underlying  
2966 - encryption key to be displayed. 2956 + When used with --show-encryption or --check, causes the
  2957 + underlying encryption key to be displayed.
2967 2958
2968 When encryption information is being displayed, as when 2959 When encryption information is being displayed, as when
2969 :qpdf:ref:`--check` or :qpdf:ref:`--show-encryption` is given, display the 2960 :qpdf:ref:`--check` or :qpdf:ref:`--show-encryption` is given, display the
@@ -3016,7 +3007,7 @@ Related Options @@ -3016,7 +3007,7 @@ Related Options
3016 reconstruction is performed, this option will show the information 3007 reconstruction is performed, this option will show the information
3017 in the reconstructed table. 3008 in the reconstructed table.
3018 3009
3019 -.. qpdf:option:: --show-object=trailer|obj[,gen] 3010 +.. qpdf:option:: --show-object={trailer|obj[,gen]}
3020 3011
3021 .. help: show contents of an object 3012 .. help: show contents of an object
3022 3013
@@ -3103,6 +3094,32 @@ Related Options @@ -3103,6 +3094,32 @@ Related Options
3103 When used with :qpdf:ref:`--show-pages`, also shows the object and 3094 When used with :qpdf:ref:`--show-pages`, also shows the object and
3104 generation numbers for the image objects on each page. 3095 generation numbers for the image objects on each page.
3105 3096
  3097 +.. qpdf:option:: --list-attachments
  3098 +
  3099 + .. help: list embedded files
  3100 +
  3101 + Show the key and stream number for each embedded file. Combine
  3102 + with --verbose for more detailed information.
  3103 +
  3104 + Show the *key* and stream number for each embedded file. With
  3105 + :qpdf:ref:`--verbose`, additional information, including preferred
  3106 + file name, description, dates, and more are also displayed. The key
  3107 + is usually but not always equal to the file name and is needed by
  3108 + some of the other options. See also :ref:`attachments`.
  3109 +
  3110 +.. qpdf:option:: --show-attachment=key
  3111 +
  3112 + .. help: export an embedded file
  3113 +
  3114 + Write the contents of the specified attachment to standard
  3115 + output as binary data. Get the key with --list-attachments.
  3116 +
  3117 + Write the contents of the specified attachment to standard output
  3118 + as binary data. The key should match one of the keys shown by
  3119 + :qpdf:ref:`--list-attachments`. If this option is given more than
  3120 + once, only the last attachment will be shown. See also
  3121 + :ref:`attachments`.
  3122 +
3106 .. _json-options: 3123 .. _json-options:
3107 3124
3108 JSON Options 3125 JSON Options
@@ -3149,7 +3166,7 @@ Related Options @@ -3149,7 +3166,7 @@ Related Options
3149 keys will be included in the JSON output. Otherwise, all keys will 3166 keys will be included in the JSON output. Otherwise, all keys will
3150 be included. 3167 be included.
3151 3168
3152 -.. qpdf:option:: --json-object=trailer|obj[,gen] 3169 +.. qpdf:option:: --json-object={trailer|obj[,gen]}
3153 3170
3154 .. help: restrict which objects are in JSON 3171 .. help: restrict which objects are in JSON
3155 3172
qpdf/test_driver.cc
@@ -3128,6 +3128,7 @@ static void test_82(QPDF&amp; pdf, char const* arg2) @@ -3128,6 +3128,7 @@ static void test_82(QPDF&amp; pdf, char const* arg2)
3128 assert(stream.isStreamOfType("/ObjStm")); 3128 assert(stream.isStreamOfType("/ObjStm"));
3129 assert(! stream.isStreamOfType("/Test")); 3129 assert(! stream.isStreamOfType("/Test"));
3130 assert(! pdf.getObjectByID(2,0).isStreamOfType("/Pages")); 3130 assert(! pdf.getObjectByID(2,0).isStreamOfType("/Pages"));
  3131 + /* cSpell: ignore Blaah Blaaah Blaaaah */
3131 auto array = QPDFObjectHandle::parse("[/Blah /Blaah /Blaaah]"); 3132 auto array = QPDFObjectHandle::parse("[/Blah /Blaah /Blaaah]");
3132 assert(array.isOrHasName("/Blah")); 3133 assert(array.isOrHasName("/Blah"));
3133 assert(array.isOrHasName("/Blaaah")); 3134 assert(array.isOrHasName("/Blaaah"));