Commit 08e4c786583e018d6a4d2f48dfd13bfee4d6a3bd
1 parent
9b3a896a
Update documentation for version 4.0
Showing
1 changed file
with
275 additions
and
12 deletions
manual/qpdf-manual.xml
| @@ -5,8 +5,8 @@ | @@ -5,8 +5,8 @@ | ||
| 5 | <!ENTITY mdash "—"> | 5 | <!ENTITY mdash "—"> |
| 6 | <!ENTITY ndash "–"> | 6 | <!ENTITY ndash "–"> |
| 7 | <!ENTITY nbsp " "> | 7 | <!ENTITY nbsp " "> |
| 8 | -<!ENTITY swversion "3.0.2"> | ||
| 9 | -<!ENTITY lastreleased "September 6, 2012"> | 8 | +<!ENTITY swversion "4.0.0"> |
| 9 | +<!ENTITY lastreleased "December 31, 2012"> | ||
| 10 | ]> | 10 | ]> |
| 11 | <book> | 11 | <book> |
| 12 | <bookinfo> | 12 | <bookinfo> |
| @@ -402,8 +402,8 @@ make | @@ -402,8 +402,8 @@ make | ||
| 402 | </para> | 402 | </para> |
| 403 | <para> | 403 | <para> |
| 404 | The value for | 404 | The value for |
| 405 | - <option><replaceable>key-length</replaceable></option> may be 40 | ||
| 406 | - or 128. The restriction flags are dependent upon key length. | 405 | + <option><replaceable>key-length</replaceable></option> may be 40, |
| 406 | + 128, or 256. The restriction flags are dependent upon key length. | ||
| 407 | When no additional restrictions are given, the default is to be | 407 | When no additional restrictions are given, the default is to be |
| 408 | fully permissive. | 408 | fully permissive. |
| 409 | </para> | 409 | </para> |
| @@ -565,6 +565,44 @@ make | @@ -565,6 +565,44 @@ make | ||
| 565 | </listitem> | 565 | </listitem> |
| 566 | </varlistentry> | 566 | </varlistentry> |
| 567 | </variablelist> | 567 | </variablelist> |
| 568 | + If <option><replaceable>key-length</replaceable></option> is 256, | ||
| 569 | + the minimum PDF version is 1.7 with extension level 8, and the | ||
| 570 | + AES-based encryption format used is the PDF 2.0 encryption method | ||
| 571 | + supported by Acrobat X. the same options are available as with | ||
| 572 | + 128 bits with the following exceptions: | ||
| 573 | + <variablelist> | ||
| 574 | + <varlistentry> | ||
| 575 | + <term><option>--use-aes</option></term> | ||
| 576 | + <listitem> | ||
| 577 | + <para> | ||
| 578 | + This option is not available with 256-bit keys. AES is always | ||
| 579 | + used with 256-bit encryption keys. | ||
| 580 | + </para> | ||
| 581 | + </listitem> | ||
| 582 | + </varlistentry> | ||
| 583 | + <varlistentry> | ||
| 584 | + <term><option>--force-V4</option></term> | ||
| 585 | + <listitem> | ||
| 586 | + <para> | ||
| 587 | + This option is not available with 256 keys. | ||
| 588 | + </para> | ||
| 589 | + </listitem> | ||
| 590 | + </varlistentry> | ||
| 591 | + <varlistentry> | ||
| 592 | + <term><option>--force-R5</option></term> | ||
| 593 | + <listitem> | ||
| 594 | + <para> | ||
| 595 | + If specified, qpdf sets the minimum version to 1.7 at | ||
| 596 | + extension level 3 and writes the deprecated encryption format | ||
| 597 | + used by Acrobat version IX. This option should not be used in | ||
| 598 | + practice to generate PDF files that will be in general use, | ||
| 599 | + but it can be useful to generate files if you are trying to | ||
| 600 | + test proper support in another application for PDF files | ||
| 601 | + encrypted in this way. | ||
| 602 | + </para> | ||
| 603 | + </listitem> | ||
| 604 | + </varlistentry> | ||
| 605 | + </variablelist> | ||
| 568 | The default for each permission option is to be fully permissive. | 606 | The default for each permission option is to be fully permissive. |
| 569 | </para> | 607 | </para> |
| 570 | </sect1> | 608 | </sect1> |
| @@ -796,6 +834,16 @@ outfile.pdf</option> | @@ -796,6 +834,16 @@ outfile.pdf</option> | ||
| 796 | will automatically increase the version as needed when adding | 834 | will automatically increase the version as needed when adding |
| 797 | features that require newer PDF readers. | 835 | features that require newer PDF readers. |
| 798 | </para> | 836 | </para> |
| 837 | + <para> | ||
| 838 | + The version number may be expressed in the form | ||
| 839 | + <replaceable>major.minor.extension-level</replaceable>, in | ||
| 840 | + which case the version is interpreted as | ||
| 841 | + <replaceable>major.minor</replaceable> at extension level | ||
| 842 | + <replaceable>extension-level</replaceable>. For example, | ||
| 843 | + version <literal>1.7.8</literal> represents version 1.7 at | ||
| 844 | + extension level 8. Note that minimal syntax checking is done | ||
| 845 | + on the command line. | ||
| 846 | + </para> | ||
| 799 | </listitem> | 847 | </listitem> |
| 800 | </varlistentry> | 848 | </varlistentry> |
| 801 | <varlistentry> | 849 | <varlistentry> |
| @@ -804,14 +852,19 @@ outfile.pdf</option> | @@ -804,14 +852,19 @@ outfile.pdf</option> | ||
| 804 | <para> | 852 | <para> |
| 805 | This option forces the PDF version to be the exact version | 853 | This option forces the PDF version to be the exact version |
| 806 | specified <emphasis>even when the file may have content that | 854 | specified <emphasis>even when the file may have content that |
| 807 | - is not supported in that version</emphasis>. In some cases, | ||
| 808 | - forcing the output file's PDF version to be lower than that of | ||
| 809 | - the input file will cause qpdf to disable certain features of | ||
| 810 | - the document. Specifically, AES encryption is disabled if the | ||
| 811 | - version is less than 1.6, cleartext metadata and object | ||
| 812 | - streams are disabled if less than 1.5, 128-bit encryption keys | ||
| 813 | - are disabled if less than 1.4, and all encryption is disabled | ||
| 814 | - if less than 1.3. Even with these precautions, qpdf won't be | 855 | + is not supported in that version</emphasis>. The version |
| 856 | + number is interpreted in the same way as with | ||
| 857 | + <option>--min-version</option> so that extension levels can be | ||
| 858 | + set. In some cases, forcing the output file's PDF version to | ||
| 859 | + be lower than that of the input file will cause qpdf to | ||
| 860 | + disable certain features of the document. Specifically, | ||
| 861 | + 256-bit keys are disabled if the version is less than 1.7 with | ||
| 862 | + extension level 8 (except R5 is disabled if less than 1.7 with | ||
| 863 | + extension level 3), AES encryption is disabled if the version | ||
| 864 | + is less than 1.6, cleartext metadata and object streams are | ||
| 865 | + disabled if less than 1.5, 128-bit encryption keys are | ||
| 866 | + disabled if less than 1.4, and all encryption is disabled if | ||
| 867 | + less than 1.3. Even with these precautions, qpdf won't be | ||
| 815 | able to do things like eliminate use of newer image | 868 | able to do things like eliminate use of newer image |
| 816 | compression schemes, transparency groups, or other features | 869 | compression schemes, transparency groups, or other features |
| 817 | that may have been added in more recent versions of PDF. | 870 | that may have been added in more recent versions of PDF. |
| @@ -1592,6 +1645,31 @@ outfile.pdf</option> | @@ -1592,6 +1645,31 @@ outfile.pdf</option> | ||
| 1592 | <classname>QPDFWriter</classname> when it rewrites encrypted | 1645 | <classname>QPDFWriter</classname> when it rewrites encrypted |
| 1593 | files. | 1646 | files. |
| 1594 | </para> | 1647 | </para> |
| 1648 | + <para> | ||
| 1649 | + When copying encrypted files, unless otherwise directed, qpdf will | ||
| 1650 | + preserve any encryption in force in the original file. qpdf can | ||
| 1651 | + do this with either the user or the owner password. There is no | ||
| 1652 | + difference in capability based on which password is used. When 40 | ||
| 1653 | + or 128 bit encryption keys are used, the user password can be | ||
| 1654 | + recovered with the owner password. With 256 keys, the user and | ||
| 1655 | + owner passwords are used independently to encrypt the actual | ||
| 1656 | + encryption key, so while either can be used, the owner password | ||
| 1657 | + can no longer be used to recover the user password. | ||
| 1658 | + </para> | ||
| 1659 | + <para> | ||
| 1660 | + Starting with version 4.0.0, qpdf can read files that are not | ||
| 1661 | + encrypted but that contain encrypted attachments, but it cannot | ||
| 1662 | + write such files. qpdf also requires the password to be specified | ||
| 1663 | + in order to open the file, not just to extract attachments, since | ||
| 1664 | + once the file is open, all decryption is handled transparently. | ||
| 1665 | + When copying files like this while preserving encryption, qpdf | ||
| 1666 | + will apply the file's encryption to everything in the file, not | ||
| 1667 | + just to the attachments. When decrypting the file, qpdf will | ||
| 1668 | + decrypt the attachments. In general, when copying PDF files with | ||
| 1669 | + multiple encryption formats, qpdf will choose the newest format. | ||
| 1670 | + The only exception to this is that clear-text metadata will be | ||
| 1671 | + preserved as clear-text if it is that way in the original file. | ||
| 1672 | + </para> | ||
| 1595 | </sect1> | 1673 | </sect1> |
| 1596 | <sect1 id="ref.adding-and-remove-pages"> | 1674 | <sect1 id="ref.adding-and-remove-pages"> |
| 1597 | <title>Adding and Removing Pages</title> | 1675 | <title>Adding and Removing Pages</title> |
| @@ -2383,6 +2461,179 @@ print "\n"; | @@ -2383,6 +2461,179 @@ print "\n"; | ||
| 2383 | </para> | 2461 | </para> |
| 2384 | <variablelist> | 2462 | <variablelist> |
| 2385 | <varlistentry> | 2463 | <varlistentry> |
| 2464 | + <term>4.0.0: December 31, 2012</term> | ||
| 2465 | + <listitem> | ||
| 2466 | + <itemizedlist> | ||
| 2467 | + <listitem> | ||
| 2468 | + <para> | ||
| 2469 | + Major enhancement: support has been added for newer encryption | ||
| 2470 | + schemes supported by version X of Adobe Acrobat. This | ||
| 2471 | + includes use of 127-character passwords, 256-bit encryption | ||
| 2472 | + keys, and the encryption scheme specified in ISO 32000-2, the | ||
| 2473 | + PDF 2.0 specification. This scheme can be chosen from the | ||
| 2474 | + command line by specifying use of 256-bit keys. qpdf also | ||
| 2475 | + supports the deprecated encryption method used by Acrobat IX. | ||
| 2476 | + This encryption style has known security weaknesses and should | ||
| 2477 | + not be used in practice. However, such files exist “in | ||
| 2478 | + the wild,” so support for this scheme is still useful. | ||
| 2479 | + New methods | ||
| 2480 | + <function>QPDFWriter::setR6EncryptionParameters</function> | ||
| 2481 | + (for the PDF 2.0 scheme) and | ||
| 2482 | + <function>QPDFWriter::setR5EncryptionParameters</function> | ||
| 2483 | + (for the deprecated scheme) have been added to enable these | ||
| 2484 | + new encryption schemes. Corresponding functions have been | ||
| 2485 | + added to the C API as well. | ||
| 2486 | + </para> | ||
| 2487 | + </listitem> | ||
| 2488 | + <listitem> | ||
| 2489 | + <para> | ||
| 2490 | + Full support for Adobe extension levels in PDF version | ||
| 2491 | + information. Starting with PDF version 1.7, corresponding to | ||
| 2492 | + ISO 32000, Adobe adds new functionality by increasing the | ||
| 2493 | + extension level rather than increasing the version. This | ||
| 2494 | + support includes addition of the | ||
| 2495 | + <function>QPDF::getExtensionLevel</function> method for | ||
| 2496 | + retrieving the document's extension level, addition of | ||
| 2497 | + versions of | ||
| 2498 | + <function>QPDFWriter::setMinimumPDFVersion</function> and | ||
| 2499 | + <function>QPDFWriter::forcePDFVersion</function> that accept | ||
| 2500 | + an extension level, and extended syntax for specifying forced | ||
| 2501 | + and minimum versions on the command line as described in <xref | ||
| 2502 | + linkend="ref.advanced-transformation"/>. Corresponding | ||
| 2503 | + functions have been added to the C API as well. | ||
| 2504 | + </para> | ||
| 2505 | + </listitem> | ||
| 2506 | + <listitem> | ||
| 2507 | + <para> | ||
| 2508 | + Minor fixes to prevent qpdf from referencing objects in the | ||
| 2509 | + file that are not referenced in the file's overall structure. | ||
| 2510 | + Most files don't have any such objects, but some files have | ||
| 2511 | + contain unreferenced objects with errors, so these fixes | ||
| 2512 | + prevent qpdf from needlessly rejecting or complaining about | ||
| 2513 | + such objects. | ||
| 2514 | + </para> | ||
| 2515 | + </listitem> | ||
| 2516 | + <listitem> | ||
| 2517 | + <para> | ||
| 2518 | + Add new generalized methods for reading and writing files | ||
| 2519 | + from/to programmer-defined sources. The method | ||
| 2520 | + <function>QPDF::processInputSource</function> allows the | ||
| 2521 | + programmer to use any input source for the input file, and | ||
| 2522 | + <function>QPDFWriter::setOutputPipeline</function> allows the | ||
| 2523 | + programmer to write the output file through any pipeline. | ||
| 2524 | + These methods would make it possible to perform any number of | ||
| 2525 | + specialized operations, such as accessing external storage | ||
| 2526 | + systems, creating bindings for qpdf in other programming | ||
| 2527 | + languages that have their own I/O systems, etc. | ||
| 2528 | + </para> | ||
| 2529 | + </listitem> | ||
| 2530 | + <listitem> | ||
| 2531 | + <para> | ||
| 2532 | + Add new method <function>QPDF::getEncryptionKey</function> for | ||
| 2533 | + retrieving the underlying encryption key used in the file. | ||
| 2534 | + </para> | ||
| 2535 | + </listitem> | ||
| 2536 | + <listitem> | ||
| 2537 | + <para> | ||
| 2538 | + This release includes a small handful of non-compatible API | ||
| 2539 | + changes. While effort is made to avoid such changes, all the | ||
| 2540 | + non-compatible API changes in this version were to parts of | ||
| 2541 | + the API that would likely never be used outside the library | ||
| 2542 | + itself. In all cases, the altered methods or structures were | ||
| 2543 | + parts of the <classname>QPDF</classname> that were public to | ||
| 2544 | + enable them to be called from either | ||
| 2545 | + <classname>QPDFWriter</classname> or were part of validation | ||
| 2546 | + code that was over-zealous in reporting problems in parts of | ||
| 2547 | + the file that would not ordinarily be referenced. In no case | ||
| 2548 | + did any of the removed methods do anything worse that falsely | ||
| 2549 | + report error conditions in files that were broken in ways that | ||
| 2550 | + didn't matter. The following public parts of the | ||
| 2551 | + <classname>QPDF</classname> class were changed in a | ||
| 2552 | + non-compatible way: | ||
| 2553 | + <itemizedlist> | ||
| 2554 | + <listitem> | ||
| 2555 | + <para> | ||
| 2556 | + Updated nested <classname>QPDF::EncryptionData</classname> | ||
| 2557 | + class to add fields needed by the newer encryption formats, | ||
| 2558 | + member variables changed to private so that future changes | ||
| 2559 | + will not require breaking backward compatibility. | ||
| 2560 | + </para> | ||
| 2561 | + </listitem> | ||
| 2562 | + <listitem> | ||
| 2563 | + <para> | ||
| 2564 | + Added additional parameters to | ||
| 2565 | + <function>compute_data_key</function>, which is used by | ||
| 2566 | + <classname>QPDFWriter</classname> to compute the encryption | ||
| 2567 | + key used to encrypt a specific object. | ||
| 2568 | + </para> | ||
| 2569 | + </listitem> | ||
| 2570 | + <listitem> | ||
| 2571 | + <para> | ||
| 2572 | + Removed the method | ||
| 2573 | + <function>flattenScalarReferences</function>. This method | ||
| 2574 | + was previously used prior to writing a new PDF file, but it | ||
| 2575 | + has the undesired side effect of causing qpdf to read | ||
| 2576 | + objects in the file that were not referenced. Some | ||
| 2577 | + otherwise files have unreferenced objects with errors in | ||
| 2578 | + them, so this could cause qpdf to reject files that would | ||
| 2579 | + be accepted by virtually all other PDF readers. In fact, | ||
| 2580 | + qpdf relied on only a very small part of what | ||
| 2581 | + flattenScalarReferences did, so only this part has been | ||
| 2582 | + preserved, and it is now done directly inside | ||
| 2583 | + <classname>QPDFWriter</classname>. | ||
| 2584 | + </para> | ||
| 2585 | + </listitem> | ||
| 2586 | + <listitem> | ||
| 2587 | + <para> | ||
| 2588 | + Removed the method <function>decodeStreams</function>. | ||
| 2589 | + This method was used by the <option>--check</option> option | ||
| 2590 | + of the <command>qpdf</command> command-line tool to force | ||
| 2591 | + all streams in the file to be decoded, but it also suffered | ||
| 2592 | + from the problem of opening otherwise unreferenced streams | ||
| 2593 | + and thus could report false positive. The | ||
| 2594 | + <option>--check</option> option now causes qpdf to go | ||
| 2595 | + through all the motions of writing a new file based on the | ||
| 2596 | + original one, so it will always reference and check exactly | ||
| 2597 | + those parts of a file that any ordinary viewer would check. | ||
| 2598 | + </para> | ||
| 2599 | + </listitem> | ||
| 2600 | + <listitem> | ||
| 2601 | + <para> | ||
| 2602 | + Removed the method | ||
| 2603 | + <function>trimTrailerForWrite</function>. This method was | ||
| 2604 | + used by <classname>QPDFWriter</classname> to modify the | ||
| 2605 | + original QPDF object by removing fields from the trailer | ||
| 2606 | + dictionary that wouldn't apply to the newly written file. | ||
| 2607 | + This functionality, though generally harmless, was a poor | ||
| 2608 | + implementation and has been replaced by having QPDFWriter | ||
| 2609 | + filter these out when copying the trailer rather than | ||
| 2610 | + modifying the original QPDF object. (Note that qpdf never | ||
| 2611 | + modifies the original file itself.) | ||
| 2612 | + </para> | ||
| 2613 | + </listitem> | ||
| 2614 | + </itemizedlist> | ||
| 2615 | + </para> | ||
| 2616 | + </listitem> | ||
| 2617 | + <listitem> | ||
| 2618 | + <para> | ||
| 2619 | + Allow the PDF header to appear anywhere in the first 1024 | ||
| 2620 | + bytes of the file. This is consistent with what other readers | ||
| 2621 | + do. | ||
| 2622 | + </para> | ||
| 2623 | + </listitem> | ||
| 2624 | + <listitem> | ||
| 2625 | + <para> | ||
| 2626 | + Fix the <command>pkg-config</command> files to list zlib and | ||
| 2627 | + pcre in <function>Requires.private</function> to better | ||
| 2628 | + support static linking using <command>pkg-config</command>. | ||
| 2629 | + </para> | ||
| 2630 | + </listitem> | ||
| 2631 | + </itemizedlist> | ||
| 2632 | + </listitem> | ||
| 2633 | + </varlistentry> | ||
| 2634 | + </variablelist> | ||
| 2635 | + <variablelist> | ||
| 2636 | + <varlistentry> | ||
| 2386 | <term>3.0.2: September 6, 2012</term> | 2637 | <term>3.0.2: September 6, 2012</term> |
| 2387 | <listitem> | 2638 | <listitem> |
| 2388 | <itemizedlist> | 2639 | <itemizedlist> |
| @@ -3274,4 +3525,16 @@ print "\n"; | @@ -3274,4 +3525,16 @@ print "\n"; | ||
| 3274 | </itemizedlist> | 3525 | </itemizedlist> |
| 3275 | </para> | 3526 | </para> |
| 3276 | </appendix> | 3527 | </appendix> |
| 3528 | + <appendix id="ref.upgrading-to-4.0"> | ||
| 3529 | + <title>Upgrading to 4.0</title> | ||
| 3530 | + <para> | ||
| 3531 | + While version 4.0 includes a few non-compatible API changes, it is | ||
| 3532 | + very unlikely that anyone's code would have used any of those parts | ||
| 3533 | + of the API since they generally required information that would | ||
| 3534 | + only be available inside the library. In the unlikely event that | ||
| 3535 | + you should run into trouble, please see the ChangeLog. See also | ||
| 3536 | + <xref linkend="ref.release-notes"/> for a complete list of the | ||
| 3537 | + non-compatible API changes made in this version. | ||
| 3538 | + </para> | ||
| 3539 | + </appendix> | ||
| 3277 | </book> | 3540 | </book> |