Commit 2280c4f6d1993bd8940f10f7a1ef0f9f22f6c518
1 parent
5878d17f
Update documentation and version numbers
3.0.rc1
Showing
10 changed files
with
673 additions
and
190 deletions
README
| ... | ... | @@ -15,11 +15,20 @@ Prerequisites |
| 15 | 15 | |
| 16 | 16 | QPDF depends on external libraries "zlib" and "pcre". These are part |
| 17 | 17 | of virtually all Linux distributions and are readily available; |
| 18 | -download information appears in the documentation. You can also | |
| 19 | -download the external library distributions in source from from qpdf's | |
| 20 | -download site. For Windows, you can download pre-built binary | |
| 21 | -verisons of those libraries for some compilers; see README-windows.txt | |
| 22 | -for additional details. | |
| 18 | +download information appears in the documentation. For Windows, you | |
| 19 | +can download pre-built binary verisons of those libraries for some | |
| 20 | +compilers; see README-windows.txt for additional details. | |
| 21 | + | |
| 22 | +QPDF requires a C++ compiler that works with STL. Your compiler must | |
| 23 | +also support "long long". Almost all modern compilers do. If you are | |
| 24 | +trying to port qpdf to a compiler that doesn't support long long, you | |
| 25 | +could change all occurrences of "long long" to "long" in the source | |
| 26 | +code, noting that this would break binary compatibility with other | |
| 27 | +builds of qpdf. Doing so would certainly prevent qpdf from working | |
| 28 | +with files larger than 2 GB, but remaining functionality would most | |
| 29 | +likely work fine. If you built qpdf this way and it passed its test | |
| 30 | +suite with large file support disabled, you could be confident that | |
| 31 | +you had an otherwise working qpdf. | |
| 23 | 32 | |
| 24 | 33 | |
| 25 | 34 | Licensing terms of embedded software |
| ... | ... | @@ -49,20 +58,23 @@ For UNIX and UNIX-like systems, you can usually get by with just |
| 49 | 58 | make |
| 50 | 59 | make install |
| 51 | 60 | |
| 52 | -For more detailed general information, see the "INSTALL" file in this | |
| 53 | -directory. | |
| 61 | +Packagers may set DESTDIR, in which case make install will install | |
| 62 | +inside of DESTDIR, as is customary with many packages. For more | |
| 63 | +detailed general information, see the "INSTALL" file in this | |
| 64 | +directory. If you are already accustomed to building and installing | |
| 65 | +software that uses autoconf, there's nothing new for you in the | |
| 66 | +INSTALL file. | |
| 67 | + | |
| 54 | 68 | |
| 55 | 69 | Building on Windows |
| 56 | 70 | =================== |
| 57 | 71 | |
| 58 | -QPDF is known to build and pass its test suite with mingw (gcc 4.4.0) | |
| 59 | -and Microsoft Visual C++ .NET 2008 Express. Either cygwin or MSYS | |
| 60 | -plus ActivateState Perl is required to build as well in order to get | |
| 61 | -make and other related tools. The MSVC works with either cygwin or | |
| 62 | -MSYS. The mingw build requires MSYS and will probably not work with | |
| 63 | -cygwin. | |
| 64 | - | |
| 65 | -For details on how to build under Windows, see README-windows.txt. | |
| 72 | +QPDF is known to build and pass its test suite with mingw (latest | |
| 73 | +version tested: gcc 4.6.2), mingw64 (latest version tested: 4.7.0) and | |
| 74 | +Microsoft Visual C++ 2010, both 32-bit and 64-bit versions. MSYS plus | |
| 75 | +ActivateState Perl is required to build as well in order to get make | |
| 76 | +and other related tools. See README-windows.txt for details on how to | |
| 77 | +build under Windows, see README-windows.txt. | |
| 66 | 78 | |
| 67 | 79 | |
| 68 | 80 | Additional Notes on Build |
| ... | ... | @@ -94,7 +106,10 @@ To learn about using the library, please read comments in the header |
| 94 | 106 | files in include/qpdf, especially QPDF.hh, QPDFObjectHandle.hh, and |
| 95 | 107 | QPDFWriter.hh. You can also study the code of qpdf/qpdf.cc, which |
| 96 | 108 | exercises most of the public interface. There are additional example |
| 97 | -programs in the examples directory. | |
| 109 | +programs in the examples directory. Reading all the source files in | |
| 110 | +the qpdf directory (including the qpdf command-line tool and some test | |
| 111 | +drivers) along with the code in the examples directory will give you a | |
| 112 | +complete picture of every aspect of the public interface. | |
| 98 | 113 | |
| 99 | 114 | |
| 100 | 115 | Additional Notes on Test Suite |
| ... | ... | @@ -102,15 +117,21 @@ Additional Notes on Test Suite |
| 102 | 117 | |
| 103 | 118 | By default, slow tests are disabled. Slow tests include image |
| 104 | 119 | comparison tests and large file tests. Image comparison tests can be |
| 105 | -enabled by passing --enable-test-compare-images to ./configure. Large | |
| 106 | -file tests can be enabled by passing --with-large-file-test-path=path | |
| 107 | -to ./configure or by setting the LARGE_FILE_TEST_PATH environment | |
| 108 | -variable. Run ./configure --help for additional options. The test | |
| 109 | -suite provides nearly full coverage even without these tests. Unless | |
| 110 | -you are making deep changes to the library or testing this on a new | |
| 111 | -platform for the first time, there is no real reason to run these | |
| 112 | -tests. If you're just running the test suite to make sure that qpdf | |
| 113 | -works for your build, the default tests are adequate. | |
| 120 | +enabled by passing --enable-test-compare-images to ./configure. This | |
| 121 | +was on by default in qpdf versions prior to 3.0, but is now off by | |
| 122 | +default. Large file tests can be enabled by passing | |
| 123 | +--with-large-file-test-path=path to ./configure or by setting the | |
| 124 | +QPDF_LARGE_FILE_TEST_PATH environment variable. Run ./configure | |
| 125 | +--help for additional options. The test suite provides nearly full | |
| 126 | +coverage even without these tests. Unless you are making deep changes | |
| 127 | +to the library that would impact the contents of the generated PDF | |
| 128 | +files or testing this on a new platform for the first time, there is | |
| 129 | +no real reason to run these tests. If you're just running the test | |
| 130 | +suite to make sure that qpdf works for your build, the default tests | |
| 131 | +are adequate. The configure rules for these tests do nothing other | |
| 132 | +than setting variables in autoconf.mk, so you can feel free to turn | |
| 133 | +these on and off directly in autoconf.mk rather than rerunning | |
| 134 | +configure. | |
| 114 | 135 | |
| 115 | 136 | If you are packaging qpdf for a distribution and preparing a build |
| 116 | 137 | that is run by an autobuilder, you may want to add the | ... | ... |
README-what-to-download.txt
| ... | ... | @@ -5,24 +5,41 @@ file. |
| 5 | 5 | For Windows, there are several additional files that you might want to |
| 6 | 6 | download. |
| 7 | 7 | |
| 8 | - * qpdf-<version>-bin-mingw.zip | |
| 8 | + * qpdf-<version>-bin-mingw32.zip | |
| 9 | 9 | |
| 10 | 10 | If you just want to use the qpdf commandline program or use the |
| 11 | 11 | qpdf DLL's C-language interface, you can download this file. You |
| 12 | 12 | can also download this version if you are using MINGW's gcc 4.4 and |
| 13 | 13 | want to program using the C++ interface. |
| 14 | 14 | |
| 15 | - * qpdf-<version>-bin-msvc.zip | |
| 15 | + * qpdf-<version>-bin-mingw64.zip | |
| 16 | + | |
| 17 | + A 64-bit version built with mingw. Use this for 64-bit Windows | |
| 18 | + systems. The 32-bit version will also work on Windows 64-bit. | |
| 19 | + Both the 32-bit and the 64-bit version support files over 2 GB in | |
| 20 | + size, but you may find it easier to integrate this with your own | |
| 21 | + software if you use the 64-bit version. | |
| 22 | + | |
| 23 | + * qpdf-<version>-bin-msvc32.zip | |
| 24 | + | |
| 25 | + If you want to program using qpdf's C++ interface and you are using | |
| 26 | + Microsoft Visual C++ 2010 in 32-bit mode, you can download this | |
| 27 | + file. | |
| 28 | + | |
| 29 | + * qpdf-<version>-bin-msvc64.zip | |
| 16 | 30 | |
| 17 | 31 | If you want to program using qpdf's C++ interface and you are using |
| 18 | - Microsoft Visual C++ .NET 2008 (VC9), you can download this file. | |
| 32 | + Microsoft Visual C++ 2010 in 64-bit mode, you can download this | |
| 33 | + file. | |
| 19 | 34 | |
| 20 | 35 | * qpdf-external-libs-bin.zip |
| 21 | 36 | |
| 22 | - If you want to build qpdf for Windows yourself with either MINGW's | |
| 23 | - gcc 4.4 or VC9, you can download this file and extract it inside | |
| 24 | - the qpdf source distribution. Please refer to README-windows.txt | |
| 25 | - in the qpdf source distribution for additional details. | |
| 37 | + If you want to build qpdf for Windows yourself with either MINGW or | |
| 38 | + MSVC 2010, you can download this file and extract it inside the | |
| 39 | + qpdf source distribution. Please refer to README-windows.txt in | |
| 40 | + the qpdf source distribution for additional details. Note that you | |
| 41 | + need the 2012-06-20 version or later to be able to build qpdf 3.0 | |
| 42 | + or newer. | |
| 26 | 43 | |
| 27 | 44 | * qpdf-external-libs-src.zip |
| 28 | 45 | ... | ... |
README-windows.txt
| 1 | 1 | Common Setup |
| 2 | 2 | ============ |
| 3 | 3 | |
| 4 | -To be able to build qpdf and run its test suite, you must have either | |
| 5 | -Cygwin or MSYS from MinGW (>= 1.0.11) installed. If you want to build | |
| 6 | -with Microsoft Visual C++, either Cygwin or MSYS will do. If you want | |
| 7 | -to build with MinGW, you must use MSYS rather than Cygwin. | |
| 4 | +You may need to disable antivirus software to run qpdf's test suite. | |
| 5 | + | |
| 6 | +To be able to build qpdf and run its test suite, you must have MSYS | |
| 7 | +from MinGW installed, and you must have ActiveState Perl. Here's what | |
| 8 | +I did on my system: | |
| 9 | + | |
| 10 | +Install ActiveState perl. | |
| 11 | + | |
| 12 | +Grab the latest mingw-get-inst. From the installation wizard, choose | |
| 13 | +to install developer kit, C, and C++ support. Once installed, you | |
| 14 | +will have an icon to start an msys shell. From the msys shell, run | |
| 15 | + | |
| 16 | +mingw-get install msys-unzip msys-zip mingw32-make | |
| 17 | + | |
| 18 | +Then replace perl and make with the appropriate versions: | |
| 19 | + | |
| 20 | +mv /bin/perl.exe /bin/msys-perl.exe | |
| 21 | +mv /bin/make.exe /bin/msys-make.exe | |
| 22 | +mv /mingw/bin/mingw32-make.exe /mingw/bin/make.exe | |
| 23 | + | |
| 24 | +Make sure perl --version shows ActiveState perl. | |
| 25 | + | |
| 26 | +To install MinGW-w64, first install msys and mingw32 as above. | |
| 27 | + | |
| 28 | +From MinGW-w64 download page, go to "Toolchains targetting | |
| 29 | +Win64/Automated Builds" and find the latest mingw-w64 that runs under | |
| 30 | +i686-mingw. It will be called something like | |
| 31 | +mingw-w64-bin_i686-mingw_yyyymmdd.zip. The compiler binaries are | |
| 32 | +32-bit, which (of course) runs on 64-bit Windows. Extract this under | |
| 33 | +C:\MinGW-w64, and add C:\MinGW-w64\bin and C:\MinGW-w64\lib\mingw to | |
| 34 | +the path. | |
| 8 | 35 | |
| 9 | 36 | As of this writing, the image comparison tests confuse ghostscript in |
| 10 | 37 | cygwin, but there's a chance they might work at some point. If you |
| 11 | -want to run them, you need ghostscript and tiff utils as well. Then | |
| 12 | -omit --disable-test-compare-images from the configure statements given | |
| 13 | -below. The image comparison tests have not been tried under MSYS. | |
| 38 | +want to run them, you need ghostscript and tiff utils as well, and you | |
| 39 | +will need to add --enable-test-compare-images from the configure | |
| 40 | +statements given below. | |
| 14 | 41 | |
| 15 | 42 | Jian Ma <stronghorse@tom.com> has generously provided a port of QPDF |
| 16 | 43 | that works with Microsoft VC6. Several changes are required, but they |
| 17 | 44 | are well documented in his port. You can find the VC6 port in the |
| 18 | -contrib area of the qpdf download area. | |
| 45 | +contrib area of the qpdf download area. It may not always be | |
| 46 | +up-to-date with the latest official qpdf release. | |
| 19 | 47 | |
| 20 | 48 | |
| 21 | 49 | External Libraries |
| ... | ... | @@ -24,13 +52,14 @@ External Libraries |
| 24 | 52 | In order to build qpdf, you must have copies of zlib and pcre. The |
| 25 | 53 | easy way to get them is to download them from the qpdf download area. |
| 26 | 54 | There are packages called external-libs-bin.zip and |
| 27 | -external-libs-src.zip. If you are building with MSVC 9 (.NET 2008) or | |
| 28 | -MINGW 4.4, you can just extract the external-libs-bin.zip zip file | |
| 29 | -into the top-level qpdf source tree. It will create a directory | |
| 30 | -called external-libs which contains header files and precompiled | |
| 31 | -libraries. Passing --enable-external-libs to ./configure (which is | |
| 32 | -done automatically if you follow the instructions below) is sufficient | |
| 33 | -to find them. | |
| 55 | +external-libs-src.zip. If you are building with MSVC 2010 or MINGW, | |
| 56 | +you can just extract the qpdf-external-libs-bin.zip zip file into the | |
| 57 | +top-level qpdf source tree. Note that you need the 2012-06-20 version | |
| 58 | +(at least) to build qpdf 3.0 or greater since this incldues 64-bit | |
| 59 | +libaries. It will create a directory called external-libs which | |
| 60 | +contains header files and precompiled libraries. Passing | |
| 61 | +--enable-external-libs to ./configure (which is done automatically if | |
| 62 | +you follow the instructions below) is sufficient to find them. | |
| 34 | 63 | |
| 35 | 64 | You can also obtain pcre and zlib directly on your own and install |
| 36 | 65 | them. If you are using mingw, you can just set CPPFLAGS, LDFLAGS, and |
| ... | ... | @@ -44,27 +73,42 @@ CPPFLAGS, LDFLAGS, LIBS in the generated autoconf.mk file. Note that |
| 44 | 73 | you should use UNIX-like syntax (-I, -L, -l) even though this is not |
| 45 | 74 | what cl takes on the command line. qpdf's build rules will fix it. |
| 46 | 75 | |
| 76 | +You can also download qpdf-external-libs-src.zip and follow the | |
| 77 | +instructions in the README.txt there for how to build external libs. | |
| 78 | + | |
| 47 | 79 | |
| 48 | 80 | Building with MinGW |
| 49 | 81 | =================== |
| 50 | 82 | |
| 51 | -QPDF is known to build and pass its test suite with MSYS-1.0.11 and | |
| 52 | -gcc 4.4.0 with C++ support. If you also have ActiveState Perl in your | |
| 53 | -path and the external-libs distribution described above, you can fully | |
| 54 | -configure, build, and test qpdf in this environment. You will most | |
| 55 | -likely not be able to build qpdf with mingw using cygwin. | |
| 83 | +QPDF is known to build and pass its test suite with mingw (latest | |
| 84 | +version tested: gcc 4.6.2), mingw64 (latest version tested: 4.7.0) and | |
| 85 | +Microsoft Visual C++ 2010, both 32-bit and 64-bit versions. MSYS plus | |
| 86 | +ActivateState Perl is required to build as well in order to get make | |
| 87 | +and other related tools. While it is possible that Cygwin could be | |
| 88 | +used to build native Windows versions of qpdf, this configuration has | |
| 89 | +not been tested recently. | |
| 56 | 90 | |
| 57 | 91 | From your MSYS prompt, run |
| 58 | 92 | |
| 59 | - ./config-mingw | |
| 93 | + ./config-mingw32 | |
| 94 | + | |
| 95 | +or | |
| 96 | + | |
| 97 | + ./config-mingw64 | |
| 60 | 98 | |
| 61 | 99 | and then |
| 62 | 100 | |
| 63 | 101 | make |
| 64 | 102 | |
| 65 | -Note that ./config-mingw just runs ./configure with specific | |
| 66 | -arguments, so you can look at it, make adjustments, and manually run | |
| 67 | -configure instead. | |
| 103 | +Note that ./config-mingw32 and ./configure-mingw64 just run | |
| 104 | +./configure with specific arguments, so you can look at it, make | |
| 105 | +adjustments, and manually run configure instead. Note also that | |
| 106 | +config-mingw32 appends definition of _FILE_OFFSET_BITS=64 to | |
| 107 | +qpdf-config.h since, as of the qpdf 3.0 release, the current versions | |
| 108 | +of the autoconf tools did not correctly detect that mingw requires | |
| 109 | +this to get large file support. This workaround is only required for | |
| 110 | +mingw32. The 64-bit version of mingw works "out of the box" with | |
| 111 | +large file support, as do both the 32-bit and 64-bit versions of MSVC. | |
| 68 | 112 | |
| 69 | 113 | Add the absolute path to the libqpdf/build directory to your PATH. |
| 70 | 114 | Make sure you can run the qpdf command by typing qpdf/build/qpdf and |
| ... | ... | @@ -80,26 +124,42 @@ create install-mingw/qpdf-VERSION and populate it. The binary |
| 80 | 124 | download of qpdf for Windows with mingw is created from this |
| 81 | 125 | directory. |
| 82 | 126 | |
| 127 | +You can also take a look at make_windows_releases for reference. This | |
| 128 | +is how the distributed Windows executables are created. | |
| 83 | 129 | |
| 84 | -Building with MSVC .NET 2008 Express | |
| 85 | -==================================== | |
| 130 | + | |
| 131 | +Building with MSVC 2010 | |
| 132 | +======================= | |
| 86 | 133 | |
| 87 | 134 | These instructions would likely work with newer version of MSVC or |
| 88 | 135 | with full version of MSVC. They may also work with .NET 2005. They |
| 89 | -have only been tested with .NET 2008 Express (VC9.0). You may follow | |
| 90 | -these instructions from either Cygwin or from MSYS, though only MSYS | |
| 91 | -is regularly tested. | |
| 136 | +have only been tested with Visual C++ 2010. Earlier version of qpdf | |
| 137 | +were built with MSVC 2008 Express. | |
| 92 | 138 | |
| 93 | 139 | You should first set up your environment to be able to run MSVC from |
| 94 | 140 | the command line. There is usually a batch file included with MSVC |
| 95 | -that does this. From that cmd prompt, you can start your cygwin | |
| 96 | -shell. | |
| 141 | +that does this. Make sure that you start a command line environment | |
| 142 | +configured for whichever of 32-bit or 64-bit output that you intend to | |
| 143 | +build for. | |
| 144 | + | |
| 145 | +From that cmd prompt, you can start your msys shell by just running | |
| 146 | +manually whatever command is associated with your msys shell icon. | |
| 97 | 147 | |
| 98 | 148 | Configure as follows: |
| 99 | 149 | |
| 100 | - ./config-msvc | |
| 150 | + ./config-msvc 32 | |
| 101 | 151 | |
| 102 | -and then | |
| 152 | +or | |
| 153 | + | |
| 154 | + ./config-msvc 64 | |
| 155 | + | |
| 156 | +Note that you must pass the 32/64 option that matches your command | |
| 157 | +line setup. The scripts do not presently figure this out. If you | |
| 158 | +used the wrong argument, it would probably just build the size you | |
| 159 | +have in your environment and then install the results in the wrong | |
| 160 | +place. | |
| 161 | + | |
| 162 | +Once configured, run | |
| 103 | 163 | |
| 104 | 164 | make |
| 105 | 165 | |
| ... | ... | @@ -156,4 +216,5 @@ when the runtime is linked in statically, exceptions cannot be thrown |
| 156 | 216 | across the DLL to EXE boundary. Since qpdf uses exception handling |
| 157 | 217 | extensively for error handling, we have no choice but to redistribute |
| 158 | 218 | the C++ runtime DLLs. Maybe this will be addressed in a future |
| 159 | -version of the compilers. | |
| 219 | +version of the compilers. This has not been retested with the | |
| 220 | +toolchain versions used to create qpdf 3.0 distributions. | ... | ... |
README.maintainer
| ... | ... | @@ -94,6 +94,7 @@ Release Reminders |
| 94 | 94 | |
| 95 | 95 | * Remember to update the web page including putting new documentation |
| 96 | 96 | in the "files" subdirectory of the website on sourceforge.net. |
| 97 | + Linearize the PDF version of the manual when copying it there. | |
| 97 | 98 | |
| 98 | 99 | * Create a tag in the version control system, and make backups of the |
| 99 | 100 | actual releases. With git, use git tag -s to create a signed tag: | ... | ... |
TODO
| 1 | -Next | |
| 2 | -==== | |
| 3 | - | |
| 4 | -*** ABI changes have been made. build.mk has been updated. | |
| 5 | - | |
| 6 | - * 64-bit windows build, remaining steps | |
| 7 | - | |
| 8 | - - new external-libs have been built and copied into | |
| 9 | - ~/Q/storage/releases/qpdf/external-libs. Release is done in | |
| 10 | - git. Just need to upload when ready. Remember to document that | |
| 11 | - this version is needed for > 2.3.1. | |
| 12 | - | |
| 13 | - - update README-windows.txt docs to indicate that MSVC 2010 is the | |
| 14 | - supported version and to update the information about mingw, | |
| 15 | - including the need for the _FILE_OFFSET_BITS workaround on the | |
| 16 | - 32-bit version. | |
| 17 | - | |
| 18 | - * Document that your compiler has to support long long. | |
| 19 | - | |
| 20 | - * Make sure that the release notes call attention to the one API | |
| 21 | - breaking change: removal of length from replaceStreamData. | |
| 22 | - | |
| 23 | - * Document thread safety: One individual QPDF or QPDFWriter object | |
| 24 | - can only be used by one thread at a time, but multiple threads can | |
| 25 | - simultaneously use separate objects. | |
| 26 | - | |
| 27 | - * Mention QPDFObjectHandle::parse in the documentation. | |
| 28 | - | |
| 29 | - * Manual: empty --empty as an input file name option | |
| 30 | - | |
| 31 | - * copyForeignObject, merge/split documentation: | |
| 32 | - | |
| 33 | - document details of --pages option in manual. Include nuances of | |
| 34 | - range parsing, such as backward ranges and "z". Discuss | |
| 35 | - implications of using --empty vs. using one of the source files as | |
| 36 | - the original file including Outlines (which basically work) and | |
| 37 | - page labels (which don't). Also mention trick of specifying two | |
| 38 | - different paths to the same file get duplication. | |
| 39 | - | |
| 40 | - Command line is | |
| 41 | - | |
| 42 | - --pages infile [ --password=pwd ] range ... -- | |
| 43 | - | |
| 44 | - The regular input referenced would be the one whose other data | |
| 45 | - would be preserved (like trailer, info, encryption, outlines, | |
| 46 | - etc.). It can be but doesn't have to be one of the files selected. | |
| 47 | - | |
| 48 | - Example: to grab pages 1-5 from file1 and 11-15 from file2 in | |
| 49 | - reverse: | |
| 50 | - | |
| 51 | - qpdf file1.pdf out.pdf --pages file1.pdf 1-5 file2.pdf 15-11 -- | |
| 52 | - | |
| 53 | - Use comments in qpdf.cc to guide internals documentation when | |
| 54 | - discussing implementation. Also see copyForeignObject as a source | |
| 55 | - for documentation. | |
| 56 | - | |
| 57 | - Document that makeIndirectObject doesn't handle foreign objects | |
| 58 | - automatically because copying a foreign object is a big enough deal | |
| 59 | - that it should be explicit. However addPages* does handle foreign | |
| 60 | - page objects automatically. | |
| 61 | - | |
| 62 | - * Document --copy-encryption and --encryption-file-password in | |
| 63 | - manual. Mention that the first half of /ID as well as all the | |
| 64 | - encryption parameters are copied. Maybe mention about StrF and | |
| 65 | - StrM with respect to AES here and also with encryption | |
| 66 | - preservation. | |
| 67 | - | |
| 68 | - | |
| 69 | -Soon | |
| 70 | -==== | |
| 71 | - | |
| 72 | - * See if I can support the new encryption formats mentioned in the | |
| 73 | - open bug on sourceforge. Check other sourceforge bugs. | |
| 74 | - | |
| 75 | - | |
| 76 | 1 | General |
| 77 | 2 | ======= |
| 78 | 3 | |
| 4 | + * See if I can support the encryption format used with /R 5 /V 5, | |
| 5 | + even though a qpdf-announce subscriber with an adobe.com email | |
| 6 | + address mentioned that this is deprecated. There is also a new | |
| 7 | + encryption format coming in a future release, which may be better | |
| 8 | + to support. As of the qpdf 3.0 release, the specification was not | |
| 9 | + publicly available yet. | |
| 10 | + | |
| 11 | + * Consider the possibility of doing something locale-aware to support | |
| 12 | + non-ASCII passwords. Update documentation if this is done. | |
| 13 | + | |
| 79 | 14 | * Look for %PDF header somewhere within the first 1024 bytes of the |
| 80 | 15 | file. Also accept headers of the form "%!PSโAdobeโN.n PDFโM.m". |
| 81 | 16 | See Implementation notes 13 and 14 in appendix H of the PDF 1.7 |
| 82 | 17 | specification. This is bug 3267974. |
| 83 | 18 | |
| 84 | - * Update qpdf docs about non-ascii passwords. See thread from | |
| 85 | - 2010-12-07,08 for details. | |
| 86 | - | |
| 87 | 19 | * Consider impact of article threads on page splitting/merging. |
| 88 | 20 | Subramanyam provided a test file; see ../misc/article-threads.pdf. |
| 89 | 21 | Email Q-Count: 431864 from 2009-11-03. Other things to consider: | ... | ... |
configure.ac
| ... | ... | @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. |
| 2 | 2 | dnl This config.in requires autoconf 2.5 or greater. |
| 3 | 3 | |
| 4 | 4 | AC_PREREQ([2.68]) |
| 5 | -AC_INIT([qpdf],[3.0.a0]) | |
| 5 | +AC_INIT([qpdf],[3.0.rc1]) | |
| 6 | 6 | |
| 7 | 7 | AC_CONFIG_MACRO_DIR([m4]) |
| 8 | 8 | AC_CONFIG_FILES([autoconf.mk]) | ... | ... |
libqpdf/QPDF.cc
manual/qpdf-manual.xml
| ... | ... | @@ -5,8 +5,8 @@ |
| 5 | 5 | <!ENTITY mdash "—"> |
| 6 | 6 | <!ENTITY ndash "–"> |
| 7 | 7 | <!ENTITY nbsp " "> |
| 8 | -<!ENTITY swversion "3.0.a0"> | |
| 9 | -<!ENTITY lastreleased "June 25, 2012"> | |
| 8 | +<!ENTITY swversion "3.0.rc1"> | |
| 9 | +<!ENTITY lastreleased "July 29, 2012"> | |
| 10 | 10 | ]> |
| 11 | 11 | <book> |
| 12 | 12 | <bookinfo> |
| ... | ... | @@ -26,6 +26,8 @@ |
| 26 | 26 | QPDF is a program that does structural, content-preserving |
| 27 | 27 | transformations on PDF files. QPDF's website is located at <ulink |
| 28 | 28 | url="http://qpdf.sourceforge.net/">http://qpdf.sourceforge.net/</ulink>. |
| 29 | + QPDF's source code is hosted on github at <ulink | |
| 30 | + url="https://github.com/qpdf/qpdf">https://github.com/qpdf/qpdf</ulink>. | |
| 29 | 31 | </para> |
| 30 | 32 | <para> |
| 31 | 33 | QPDF has been released under the terms of <ulink |
| ... | ... | @@ -56,14 +58,28 @@ |
| 56 | 58 | about how they work. |
| 57 | 59 | </para> |
| 58 | 60 | <para> |
| 59 | - QPDF is <emphasis>not</emphasis> a PDF content creation library, a | |
| 60 | - PDF viewer, or a program capable of converting PDF into other | |
| 61 | - formats. In particular, QPDF knows nothing about the semantics of | |
| 62 | - PDF content streams. If you are looking for something that can do | |
| 61 | + With QPDF, it is possible to copy objects from one PDF file into | |
| 62 | + another and to manipulate the list of pages in a PDF file. This | |
| 63 | + makes it possible to merge and split PDF files. The QPDF library | |
| 64 | + also makes it possible for you to create PDF files from scratch. | |
| 65 | + In this mode, you are responsible for supplying all the contents of | |
| 66 | + the file, while the QPDF library takes care off all the syntactical | |
| 67 | + representation of the objects, creation of cross references tables | |
| 68 | + and, if you use them, object streams, encryption, linearization, | |
| 69 | + and other syntactic details. You are still responsible for | |
| 70 | + generating PDF content on your own. | |
| 71 | + </para> | |
| 72 | + <para> | |
| 73 | + QPDF has been designed with very few external dependencies, and it | |
| 74 | + is intentionally very lightweight. QPDF is | |
| 75 | + <emphasis>not</emphasis> a PDF content creation library, a PDF | |
| 76 | + viewer, or a program capable of converting PDF into other formats. | |
| 77 | + In particular, QPDF knows nothing about the semantics of PDF | |
| 78 | + content streams. If you are looking for something that can do | |
| 63 | 79 | that, you should look elsewhere. However, once you have a valid |
| 64 | 80 | PDF file, QPDF can be used to transform that file in ways perhaps |
| 65 | - your original PDF creation can't handle. For example, programs | |
| 66 | - generate simple PDF files but can't password-protect them, | |
| 81 | + your original PDF creation can't handle. For example, many | |
| 82 | + programs generate simple PDF files but can't password-protect them, | |
| 67 | 83 | web-optimize them, or perform other transformations of that type. |
| 68 | 84 | </para> |
| 69 | 85 | </chapter> |
| ... | ... | @@ -112,17 +128,34 @@ |
| 112 | 128 | -u</command>. |
| 113 | 129 | </para> |
| 114 | 130 | </listitem> |
| 131 | + <listitem> | |
| 132 | + <para> | |
| 133 | + A C++ compiler that works well with STL and has the <type>long | |
| 134 | + long</type> type. Most modern C++ compilers should fit the | |
| 135 | + bill fine. QPDF is tested with gcc and Microsoft Visual C++. | |
| 136 | + </para> | |
| 137 | + </listitem> | |
| 115 | 138 | </itemizedlist> |
| 116 | 139 | </para> |
| 117 | 140 | <para> |
| 118 | 141 | Part of qpdf's test suite does comparisons of the contents PDF |
| 119 | - files by converting them images and comparing the images. You can | |
| 120 | - optionally disable this part of the test suite by running | |
| 121 | - <command>configure</command> with the | |
| 122 | - <option>--disable-test-compare-images</option> flag. If you leave | |
| 123 | - this enabled, the following additional requirements are required | |
| 124 | - by the test suite. Note that in no case are these items required | |
| 125 | - to use qpdf. | |
| 142 | + files by converting them images and comparing the images. The | |
| 143 | + image comparison tests are disabled by default. Those tests are | |
| 144 | + not required for determining correctness of a qpdf build if you | |
| 145 | + have not modified the code since the test suite also contains | |
| 146 | + expected output files that are compared literally. The image | |
| 147 | + comparison tests provide an extra check to make sure that any | |
| 148 | + content transformations don't break the rendering of pages. | |
| 149 | + Transformations that affect the content streams themselves are off | |
| 150 | + by default and are only provided to help developers look into the | |
| 151 | + contents of PDF files. If you are making deep changes to the | |
| 152 | + library that cause changes in the contents of the files that qpdf | |
| 153 | + generates, then you should enable the image comparison tests. | |
| 154 | + Enable them by running <command>configure</command> with the | |
| 155 | + <option>--enable-test-compare-images</option> flag. If you enable | |
| 156 | + this, the following additional requirements are required by the | |
| 157 | + test suite. Note that in no case are these items required to use | |
| 158 | + qpdf. | |
| 126 | 159 | <itemizedlist> |
| 127 | 160 | <listitem> |
| 128 | 161 | <para> |
| ... | ... | @@ -132,13 +165,12 @@ |
| 132 | 165 | <listitem> |
| 133 | 166 | <para> |
| 134 | 167 | GhostScript version 8.60 or newer: <ulink |
| 135 | - url="http://pages.cs.wisc.edu/~ghost/">http://pages.cs.wisc.edu/~ghost/</ulink> | |
| 168 | + url="http://www.ghostscript.com">http://www.ghostscript.com</ulink> | |
| 136 | 169 | </para> |
| 137 | 170 | </listitem> |
| 138 | 171 | </itemizedlist> |
| 139 | - This option is primarily intended for use by packagers of qpdf so | |
| 140 | - that they can avoid having the qpdf packages depend on tiff and | |
| 141 | - ghostscript software. | |
| 172 | + If you do not enable this, then you do not need to have tiff and | |
| 173 | + ghostscript. | |
| 142 | 174 | </para> |
| 143 | 175 | <para> |
| 144 | 176 | If Adobe Reader is installed as <command>acroread</command>, some |
| ... | ... | @@ -158,7 +190,7 @@ |
| 158 | 190 | To build the PDF version of the documentation, you need Apache fop |
| 159 | 191 | (<ulink |
| 160 | 192 | url="http://xml.apache.org/fop/">http://xml.apache.org/fop/</ulink>) |
| 161 | - version 0.94 of higher. | |
| 193 | + version 0.94 or higher. | |
| 162 | 194 | </para> |
| 163 | 195 | </sect1> |
| 164 | 196 | <sect1 id="ref.building"> |
| ... | ... | @@ -182,9 +214,9 @@ make |
| 182 | 214 | Building on Windows is a little bit more complicated. For |
| 183 | 215 | details, please see <filename>README-windows.txt</filename> in the |
| 184 | 216 | source distribution. You can also download a binary distribution |
| 185 | - for Windows. There is a port of qpdf in the | |
| 186 | - <filename>contrib</filename> area generously contributed by Jian | |
| 187 | - Ma. This is also discussed in more detail in | |
| 217 | + for Windows. There is a port of qpdf to Visual C++ version 6 in | |
| 218 | + the <filename>contrib</filename> area generously contributed by | |
| 219 | + Jian Ma. This is also discussed in more detail in | |
| 188 | 220 | <filename>README-windows.txt</filename>. |
| 189 | 221 | </para> |
| 190 | 222 | <para> |
| ... | ... | @@ -215,7 +247,12 @@ make |
| 215 | 247 | identical to the input file but may have been structurally |
| 216 | 248 | reorganized. Also, orphaned objects will be removed from the |
| 217 | 249 | file. Many transformations are available as controlled by the |
| 218 | - options below. | |
| 250 | + options below. In place of <option>infilename</option>, the | |
| 251 | + parameter <option>--empty</option> may be specified. This causes | |
| 252 | + qpdf to use a dummy input file that contains zero pages. The only | |
| 253 | + normal use case for using <option>--empty</option> would be if you | |
| 254 | + were going to add pages from another source, as discussed in <xref | |
| 255 | + linkend="ref.page-selection"/>. | |
| 219 | 256 | </para> |
| 220 | 257 | <para> |
| 221 | 258 | <option>outfilename</option> does not have to be seekable, even |
| ... | ... | @@ -248,7 +285,35 @@ make |
| 248 | 285 | <term><option>--linearize</option></term> |
| 249 | 286 | <listitem> |
| 250 | 287 | <para> |
| 251 | - Causes generation of a linearized (web optimized) output file. | |
| 288 | + Causes generation of a linearized (web-optimized) output file. | |
| 289 | + </para> | |
| 290 | + </listitem> | |
| 291 | + </varlistentry> | |
| 292 | + <varlistentry> | |
| 293 | + <term><option>--copy-encryption=file</option></term> | |
| 294 | + <listitem> | |
| 295 | + <para> | |
| 296 | + Encrypt the file using the same encryption parameters, | |
| 297 | + including user and owner password, as the specified file. Use | |
| 298 | + <option>--encrypt-file-password</option> to specify a password | |
| 299 | + if one is needed to open this file. Note that copying the | |
| 300 | + encryption parameters from a file also copies the first half | |
| 301 | + of <literal>/ID</literal> from the file since this is part of | |
| 302 | + the encryption parameters. | |
| 303 | + </para> | |
| 304 | + </listitem> | |
| 305 | + </varlistentry> | |
| 306 | + <varlistentry> | |
| 307 | + <term><option>--encrypt-file-password=password</option></term> | |
| 308 | + <listitem> | |
| 309 | + <para> | |
| 310 | + If the file specified with <option>--copy-encryption</option> | |
| 311 | + requires a password, specify the password using this option. | |
| 312 | + Note that only one of the user or owner password is required. | |
| 313 | + Both passwords will be preserved since QPDF does not | |
| 314 | + distinguish between the two passwords. It is possible to | |
| 315 | + preserve encryption parameters, including the owner password, | |
| 316 | + from a file even if you don't know the file's owner password. | |
| 252 | 317 | </para> |
| 253 | 318 | </listitem> |
| 254 | 319 | </varlistentry> |
| ... | ... | @@ -271,6 +336,16 @@ make |
| 271 | 336 | </para> |
| 272 | 337 | </listitem> |
| 273 | 338 | </varlistentry> |
| 339 | + <varlistentry> | |
| 340 | + <term><option>--pages options --</option></term> | |
| 341 | + <listitem> | |
| 342 | + <para> | |
| 343 | + Select specific pages from one or more input files. See <xref | |
| 344 | + linkend="ref.page-selection"/> for details on how to do page | |
| 345 | + selection (splitting and merging). | |
| 346 | + </para> | |
| 347 | + </listitem> | |
| 348 | + </varlistentry> | |
| 274 | 349 | </variablelist> |
| 275 | 350 | </para> |
| 276 | 351 | <para> |
| ... | ... | @@ -289,6 +364,25 @@ make |
| 289 | 364 | restrictions or other restrictions placed on files by their |
| 290 | 365 | producers. |
| 291 | 366 | </para> |
| 367 | + <para> | |
| 368 | + In all cases where qpdf allows specification of a password, care | |
| 369 | + must be taken if the password contains characters that fall | |
| 370 | + outside of the 7-bit US-ASCII character range to ensure that the | |
| 371 | + exact correct byte sequence is provided. It is possible that a | |
| 372 | + future version of qpdf may handle this more gracefully. For | |
| 373 | + example, if a password was encrypted using a password that was | |
| 374 | + encoded in ISO-8859-1 and your terminal is configured to use | |
| 375 | + UTF-8, the password you supply may not work properly. There are | |
| 376 | + various approaches to handling this. For example, if you are | |
| 377 | + using Linux and have the iconv executable (part of the ICU | |
| 378 | + package) installed, you could pass <option>--password=`echo | |
| 379 | + <replaceable>password</replaceable> | iconv -t | |
| 380 | + iso-8859-1`</option> to qpdf where | |
| 381 | + <replaceable>password</replaceable> is a password specified in | |
| 382 | + your terminal's locale. A detailed discussion of this is out of | |
| 383 | + scope for this manual, but just be aware of this issue if you have | |
| 384 | + trouble with a password that contains 8-bit characters. | |
| 385 | + </para> | |
| 292 | 386 | </sect1> |
| 293 | 387 | <sect1 id="ref.encryption-options"> |
| 294 | 388 | <title>Encryption Options</title> |
| ... | ... | @@ -474,6 +568,126 @@ make |
| 474 | 568 | The default for each permission option is to be fully permissive. |
| 475 | 569 | </para> |
| 476 | 570 | </sect1> |
| 571 | + <sect1 id="ref.page-selection"> | |
| 572 | + <title>Page Selection Options</title> | |
| 573 | + <para> | |
| 574 | + Starting with qpdf 3.0, it is possible to split and merge PDF | |
| 575 | + files by selecting pages from one or more input files. Whatever | |
| 576 | + file is given as the primary input file is used as the starting | |
| 577 | + point, but its pages are replaced with pages as specified. | |
| 578 | + | |
| 579 | + <programlisting><option>--pages <replaceable>input-file</replaceable> [ <replaceable>--password=password</replaceable> ] <replaceable>page-range</replaceable> [ ... ] --</option> | |
| 580 | +</programlisting> | |
| 581 | + Multiple input files may be specified. Each one is given as the | |
| 582 | + name of the input file, an optional password (if required to open | |
| 583 | + the file), and the range of pages. Note that | |
| 584 | + “<option>--</option>” terminates parsing of page | |
| 585 | + selection flags. | |
| 586 | + </para> | |
| 587 | + <para> | |
| 588 | + For each file that pages should be taken from, specify the file, a | |
| 589 | + password needed to open the file (if needed), and a page range. | |
| 590 | + If the primary input file file requires a password, that password | |
| 591 | + must be specified outside the <option>--pages</option> option and | |
| 592 | + does not need to be repeated inside the <option>--pages</option>. | |
| 593 | + The same file can be repeated multiple times. If a file that is | |
| 594 | + repeated has a password, the password only has to be given the | |
| 595 | + first time. All non-page data (info, outlines, page numbers, | |
| 596 | + etc.) are taken from the primary input file. To discard these, | |
| 597 | + use <option>--empty</option> as the primary input. One subtlety | |
| 598 | + about specifying passwords is that specifying a password as | |
| 599 | + <option>--encryption-file-password</option> doesn't prevent you | |
| 600 | + from having to repeat that password of that is also one of the | |
| 601 | + input files. If in doubt, it's never an error to specify the | |
| 602 | + password multiple times. | |
| 603 | + </para> | |
| 604 | + <para> | |
| 605 | + It is not presently possible to specify the same page from the | |
| 606 | + same file directly more than once, but you can make this work by | |
| 607 | + specifying two different paths to the same file (such as by | |
| 608 | + putting <filename>./</filename> somewhere in the path). This can | |
| 609 | + also be used if you want to repeat a page from one of the input | |
| 610 | + files in the output file. This may be made more convenient in a | |
| 611 | + future version of qpdf if there is enough demand for this feature. | |
| 612 | + </para> | |
| 613 | + <para> | |
| 614 | + The page range is a set of numbers separated by commas, ranges of | |
| 615 | + numbers separated dashes, or combinations of those. The character | |
| 616 | + “z” represents the last page. Pages can appear in any | |
| 617 | + order. Ranges can appear with a high number followed by a low | |
| 618 | + number, which causes the pages to appear in reverse. Repeating a | |
| 619 | + number will cause an error, but you can use the workaround | |
| 620 | + discussed above should you really want to include the same page | |
| 621 | + twice. | |
| 622 | + </para> | |
| 623 | + <para> | |
| 624 | + Example page ranges: | |
| 625 | + <itemizedlist> | |
| 626 | + <listitem> | |
| 627 | + <para> | |
| 628 | + <literal>1,3,5-9,15-12</literal>: pages 1, 2, 3, 5, 6, 7, 8, | |
| 629 | + 9, 15, 14, 13, and 12. | |
| 630 | + </para> | |
| 631 | + </listitem> | |
| 632 | + <listitem> | |
| 633 | + <para> | |
| 634 | + <literal>z-1</literal>: all pages in the document in reverse | |
| 635 | + </para> | |
| 636 | + </listitem> | |
| 637 | + </itemizedlist> | |
| 638 | + </para> | |
| 639 | + <para> | |
| 640 | + Note that qpdf doesn't presently do anything special about other | |
| 641 | + constructs in a PDF file that may know about pages, so semantics | |
| 642 | + of splitting and merging vary across features. For example, the | |
| 643 | + document's outlines (bookmarks) point to actual page objects, so | |
| 644 | + if you select some pages and not others, bookmarks that point to | |
| 645 | + pages that are in the output file will work, and remaining | |
| 646 | + bookmarks will not work. On the other hand, page labels (page | |
| 647 | + numbers specified in the file) are just sequential, so page labels | |
| 648 | + will be messed up in the output file. A future version of | |
| 649 | + <command>qpdf</command> may do a better job at handling these | |
| 650 | + issues. (Note that the qpdf library already contains all of the | |
| 651 | + APIs required in order to implement this in your own application | |
| 652 | + if you need it.) In the mean time, you can always use | |
| 653 | + <option>--empty</option> as the primary input file to avoid | |
| 654 | + copying all of that from the first file. For example, to take | |
| 655 | + pages 1 through 5 from a <filename>infile.pdf</filename> while | |
| 656 | + preserving all metadata associated with that file, you could use | |
| 657 | + | |
| 658 | + <programlisting><command>qpdf</command> <option>infile.pdf --pages infile.pdf 1-5 -- outfile.pdf</option> | |
| 659 | +</programlisting> | |
| 660 | + If you wanted pages 1 through 5 from | |
| 661 | + <filename>infile.pdf</filename> but you wanted the rest of the | |
| 662 | + metadata to be dropped, you could instead run | |
| 663 | + | |
| 664 | + <programlisting><command>qpdf</command> <option>--empty --pages infile.pdf 1-5 -- outfile.pdf</option> | |
| 665 | +</programlisting> | |
| 666 | + If you wanted to take pages 1–5 from | |
| 667 | + <filename>file1.pdf</filename> and pages 11–15 from | |
| 668 | + <filename>file2.pdf</filename> in reverse, you would run | |
| 669 | + | |
| 670 | + <programlisting><command>qpdf</command> <option>file1.pdf --pages file1.pdf 1-5 file2.pdf 15-11 -- outfile.pdf</option> | |
| 671 | +</programlisting> | |
| 672 | + If, for some reason, you wanted to take the first page of an | |
| 673 | + encrypted file called <filename>encrypted.pdf</filename> with | |
| 674 | + password <literal>pass</literal> and repeat it twice in an output | |
| 675 | + file, and if you wanted to drop metadata (like page numbers and | |
| 676 | + outlines) but preserve encryption, you would use | |
| 677 | + | |
| 678 | + <programlisting><command>qpdf</command> <option>--empty --copy-encryption=encrypted.pdf --encryption-file-password=pass | |
| 679 | +--pages encrypted.pdf --password=pass 1 ./encrypted.pdf --password=pass 1 -- | |
| 680 | +outfile.pdf</option> | |
| 681 | +</programlisting> | |
| 682 | + Note that we had to specify the password all three times because | |
| 683 | + giving a password as <option>--encryption-file-password</option> | |
| 684 | + doesn't count for page selection, and as far as qpdf is concerned, | |
| 685 | + <filename>encrypted.pdf</filename> and | |
| 686 | + <filename>./encrypted.pdf</filename> are separated files. These | |
| 687 | + are all corner cases that most users should hopefully never have | |
| 688 | + to be bothered with. | |
| 689 | + </para> | |
| 690 | + </sect1> | |
| 477 | 691 | <sect1 id="ref.advanced-transformation"> |
| 478 | 692 | <title>Advanced Transformation Options</title> |
| 479 | 693 | <para> |
| ... | ... | @@ -1053,6 +1267,14 @@ make |
| 1053 | 1267 | your system understands how to read libtool |
| 1054 | 1268 | <filename>.la</filename> files, this may not be necessary. |
| 1055 | 1269 | </para> |
| 1270 | + <para> | |
| 1271 | + The qpdf library is safe to use in a multithreaded program, but no | |
| 1272 | + individual <type>QPDF</type> object instance (including | |
| 1273 | + <type>QPDF</type>, <type>QPDFObjectHandle</type>, or | |
| 1274 | + <type>QPDFWriter</type>) can be used in more than one thread at a | |
| 1275 | + time. Multiple threads may simultaneously work with different | |
| 1276 | + instances of these and all other QPDF objects. | |
| 1277 | + </para> | |
| 1056 | 1278 | </chapter> |
| 1057 | 1279 | <chapter id="ref.design"> |
| 1058 | 1280 | <title>Design and Library Notes</title> |
| ... | ... | @@ -1156,17 +1378,15 @@ make |
| 1156 | 1378 | which objects are direct and which objects are indirect. |
| 1157 | 1379 | </para> |
| 1158 | 1380 | <para> |
| 1159 | - There is no public interface for creating instances of | |
| 1160 | - QPDFObjectHandle. They can be created only inside the QPDF | |
| 1161 | - library. This is generally done through a call to the private | |
| 1162 | - method <function>QPDF::readObject</function> which uses | |
| 1163 | - <classname>QPDFTokenizer</classname> to read an indirect object at | |
| 1164 | - a given file position and return a | |
| 1165 | - <classname>QPDFObjectHandle</classname> that encapsulates it. | |
| 1166 | - There are also internal methods to create fabricated indirect | |
| 1167 | - objects from existing direct objects or to change an indirect | |
| 1168 | - object into a direct object, though these steps are not performed | |
| 1169 | - except to support rewriting. | |
| 1381 | + Instances of <classname>QPDFObjectHandle</classname> can be | |
| 1382 | + directly created and modified using static factory methods in the | |
| 1383 | + <classname>QPDFObjectHandle</classname> class. There are factory | |
| 1384 | + methods for each type of object as well as a convenience method | |
| 1385 | + <function>QPDFObjectHandle::parse</function> that creates an | |
| 1386 | + object from a string representation of the object. Existing | |
| 1387 | + instances of <classname>QPDFObjectHandle</classname> can also be | |
| 1388 | + modified in several ways. See comments in | |
| 1389 | + <filename>QPDFObjectHandle.hh</filename> for details. | |
| 1170 | 1390 | </para> |
| 1171 | 1391 | <para> |
| 1172 | 1392 | When the <classname>QPDF</classname> class creates a new object, |
| ... | ... | @@ -1377,6 +1597,86 @@ make |
| 1377 | 1597 | files. |
| 1378 | 1598 | </para> |
| 1379 | 1599 | </sect1> |
| 1600 | + <sect1 id="ref.adding-and-remove-pages"> | |
| 1601 | + <title>Adding and Removing Pages</title> | |
| 1602 | + <para> | |
| 1603 | + While qpdf's API has supported adding and modifying objects for | |
| 1604 | + some time, version 3.0 introduces specific methods for adding and | |
| 1605 | + removing pages. These are largely convenience routines that | |
| 1606 | + handle two tricky issues: pushing inheritable resources from the | |
| 1607 | + <literal>/Pages</literal> tree down to individual pages and | |
| 1608 | + manipulation of the <literal>/Pages</literal> tree itself. For | |
| 1609 | + details, see <function>addPage</function> and surrounding methods | |
| 1610 | + in <filename>QPDF.hh</filename>. | |
| 1611 | + </para> | |
| 1612 | + </sect1> | |
| 1613 | + <sect1 id="ref.reserved-objects"> | |
| 1614 | + <title>Reserving Object Numbers</title> | |
| 1615 | + <para> | |
| 1616 | + Version 3.0 of qpdf introduced the concept of reserved objects. | |
| 1617 | + These are seldom needed for ordinary operations, but there are | |
| 1618 | + cases in which you may want to add a series of indirect objects | |
| 1619 | + with references to each other to a <classname>QPDF</classname> | |
| 1620 | + object. This causes a problem because you can't determine the | |
| 1621 | + object ID that a new indirect object will have until you add it to | |
| 1622 | + the <classname>QPDF</classname> object with | |
| 1623 | + <function>QPDF::makeIndirectObject</function>. The only way to | |
| 1624 | + add two mutually referential objects to a | |
| 1625 | + <classname>QPDF</classname> object prior to version 3.0 would be | |
| 1626 | + to add the new objects first and then make them refer to each | |
| 1627 | + other after adding them. Now it is possible to create a | |
| 1628 | + <firstterm>reserved object</firstterm> using | |
| 1629 | + <function>QPDFObjectHandle::newReserved</function>. This is an | |
| 1630 | + indirect object that stays “unresolved” even if it is | |
| 1631 | + queried for its type. So now, if you want to create a set of | |
| 1632 | + mutually referential objects, you can create reservations for each | |
| 1633 | + one of them and use those reservations to construct the | |
| 1634 | + references. When finished, you can call | |
| 1635 | + <function>QPDF::replaceReserved</function> to replace the reserved | |
| 1636 | + objects with the real ones. This functionality will never be | |
| 1637 | + needed by most applications, but it is used internally by QPDF | |
| 1638 | + when copying objects from other PDF files, as discussed in <xref | |
| 1639 | + linkend="ref.foreign-objects"/>. For an example of how to use | |
| 1640 | + reserved objects, search for <function>newReserved</function> in | |
| 1641 | + <filename>test_driver.cc</filename> in qpdf's sources. | |
| 1642 | + </para> | |
| 1643 | + </sect1> | |
| 1644 | + <sect1 id="ref.foreign-objects"> | |
| 1645 | + <title>Copying Objects From Other PDF Files</title> | |
| 1646 | + <para> | |
| 1647 | + Version 3.0 of qpdf introduced the ability to copy objects into a | |
| 1648 | + <classname>QPDF</classname> object from a different | |
| 1649 | + <classname>QPDF</classname> object, which we refer to as | |
| 1650 | + <firstterm>foreign objects</firstterm>. This allows arbitrary | |
| 1651 | + merging of PDF files. The <command>qpdf</command> command-line | |
| 1652 | + tool provides limited support for basic page selection, including | |
| 1653 | + merging in pages from other files, but the library's API makes it | |
| 1654 | + possible to implement arbitrarily complex merging operations. The | |
| 1655 | + main method for copying foreign objects is | |
| 1656 | + <function>QPDF::copyForeignObject</function>. This takes an | |
| 1657 | + indirect object from another <classname>QPDF</classname> and | |
| 1658 | + copies it recursively into this object while preserving all object | |
| 1659 | + structure, including circular references. This means you can add | |
| 1660 | + a direct object that you create from scratch to a | |
| 1661 | + <classname>QPDF</classname> object with | |
| 1662 | + <function>QPDF::makeIndirectObject</function>, and you can add an | |
| 1663 | + indirect object from another file with | |
| 1664 | + <function>QPDF::copyForeignObject</function>. The fact that | |
| 1665 | + <function>QPDF::makeIndirectObject</function> does not | |
| 1666 | + automatically detect a foreign object and copy it is an explicit | |
| 1667 | + design decision. Copying a foreign object seems like a | |
| 1668 | + sufficiently significant thing to do that it should be done | |
| 1669 | + explicitly. | |
| 1670 | + </para> | |
| 1671 | + <para> | |
| 1672 | + The other way to copy foreign objects is by passing a page from | |
| 1673 | + one <classname>QPDF</classname> to another by calling | |
| 1674 | + <function>QPDF::addPage</function>. In contrast to | |
| 1675 | + <function>QPDF::makeIndirectObject</function>, this method | |
| 1676 | + automatically distinguishes between indirect objects in the | |
| 1677 | + current file, foreign objects, and direct objects. | |
| 1678 | + </para> | |
| 1679 | + </sect1> | |
| 1380 | 1680 | <sect1 id="ref.rewriting"> |
| 1381 | 1681 | <title>Writing PDF Files</title> |
| 1382 | 1682 | <para> |
| ... | ... | @@ -1892,8 +2192,8 @@ print "\n"; |
| 1892 | 2192 | <para> |
| 1893 | 2193 | The specification recommends limiting the number of objects in |
| 1894 | 2194 | object stream for efficiency in reading and decoding. Acrobat 6 |
| 1895 | - uses no more than objects per object stream for linearized files | |
| 1896 | - and no more 200 objects per stream for non-linearized files. | |
| 2195 | + uses no more than 100 objects per object stream for linearized | |
| 2196 | + files and no more 200 objects per stream for non-linearized files. | |
| 1897 | 2197 | <classname>QPDFWriter</classname>, in object stream generation |
| 1898 | 2198 | mode, never puts more than 100 objects in an object stream. |
| 1899 | 2199 | </para> |
| ... | ... | @@ -2087,6 +2387,119 @@ print "\n"; |
| 2087 | 2387 | </para> |
| 2088 | 2388 | <variablelist> |
| 2089 | 2389 | <varlistentry> |
| 2390 | + <term>3.0.rc1: July 29, 2012</term> | |
| 2391 | + <listitem> | |
| 2392 | + <itemizedlist> | |
| 2393 | + <listitem> | |
| 2394 | + <para> | |
| 2395 | + Acknowledgment: I would like to express gratitude for the | |
| 2396 | + contributions of Tobias Hoffmann toward the release of qpdf | |
| 2397 | + version 3.0. He is responsible for most of the implementation | |
| 2398 | + and design of the new API for manipulating pages, and | |
| 2399 | + contributed code and ideas for many of the improvements made | |
| 2400 | + in version 3.0. Without his work, this release would | |
| 2401 | + certainly not have happened as soon as it did, if at all. | |
| 2402 | + </para> | |
| 2403 | + </listitem> | |
| 2404 | + <listitem> | |
| 2405 | + <para> | |
| 2406 | + <emphasis>Non-compatible API change:</emphasis> The version of | |
| 2407 | + <function>QPDFObjectHandle::replaceStreamData</function> that | |
| 2408 | + uses a <classname>StreamDataProvider</classname> no longer | |
| 2409 | + requires (or accepts) a <varname>length</varname> parameter. | |
| 2410 | + See <xref linkend="ref.upgrading-to-3.0"/> for an explanation. | |
| 2411 | + While care is taken to avoid non-compatible API changes in | |
| 2412 | + general, an exception was made this time because the new | |
| 2413 | + interface offers an opportunity to significantly simplify | |
| 2414 | + calling code. | |
| 2415 | + </para> | |
| 2416 | + </listitem> | |
| 2417 | + <listitem> | |
| 2418 | + <para> | |
| 2419 | + Support has been added for large files. The test suite | |
| 2420 | + verifies support for files larger than 4 gigabytes, and manual | |
| 2421 | + testing has verified support for files larger than 10 | |
| 2422 | + gigabytes. Large file support is available for both 32-bit | |
| 2423 | + and 64-bit platforms as long as the compiler and underlying | |
| 2424 | + platforms support it. | |
| 2425 | + </para> | |
| 2426 | + </listitem> | |
| 2427 | + <listitem> | |
| 2428 | + <para> | |
| 2429 | + Support for page selection (splitting and merging PDF files) | |
| 2430 | + has been added to the <command>qpdf</command> command-line | |
| 2431 | + tool. See <xref linkend="ref.page-selection"/>. | |
| 2432 | + </para> | |
| 2433 | + </listitem> | |
| 2434 | + <listitem> | |
| 2435 | + <para> | |
| 2436 | + Options have been added to the <command>qpdf</command> | |
| 2437 | + command-line tool for copying encryption parameters from | |
| 2438 | + another file. See <xref linkend="ref.basic-options"/>. | |
| 2439 | + </para> | |
| 2440 | + </listitem> | |
| 2441 | + <listitem> | |
| 2442 | + <para> | |
| 2443 | + New methods have been added to the <classname>QPDF</classname> | |
| 2444 | + object for adding and removing pages. See <xref | |
| 2445 | + linkend="ref.adding-and-remove-pages"/>. | |
| 2446 | + </para> | |
| 2447 | + </listitem> | |
| 2448 | + <listitem> | |
| 2449 | + <para> | |
| 2450 | + New methods have been added to the <classname>QPDF</classname> | |
| 2451 | + object for copying objects from other PDF files. See <xref | |
| 2452 | + linkend="ref.foreign-objects"/> | |
| 2453 | + </para> | |
| 2454 | + </listitem> | |
| 2455 | + <listitem> | |
| 2456 | + <para> | |
| 2457 | + A new method <function>QPDFObjectHandle::parse</function> has | |
| 2458 | + been added for constructing | |
| 2459 | + <classname>QPDFObjectHandle</classname> objects from a string | |
| 2460 | + description. | |
| 2461 | + </para> | |
| 2462 | + </listitem> | |
| 2463 | + <listitem> | |
| 2464 | + <para> | |
| 2465 | + Methods have been added to <classname>QPDFWriter</classname> | |
| 2466 | + to allow writing to an already open stdio <type>FILE*</type> | |
| 2467 | + addition to writing to standard output or a named file. | |
| 2468 | + Methods have been added to <classname>QPDF</classname> to be | |
| 2469 | + able to process a file from an already open stdio | |
| 2470 | + <type>FILE*</type>. This makes it possible to read and write | |
| 2471 | + PDF from secure temporary files that have been unlinked prior | |
| 2472 | + to being fully read or written. | |
| 2473 | + </para> | |
| 2474 | + </listitem> | |
| 2475 | + <listitem> | |
| 2476 | + <para> | |
| 2477 | + The <function>QPDF::emptyPDF</function> can be used to allow | |
| 2478 | + creation of PDF files from scratch. The example | |
| 2479 | + <filename>examples/pdf-create.cc</filename> illustrates how it | |
| 2480 | + can be used. | |
| 2481 | + </para> | |
| 2482 | + </listitem> | |
| 2483 | + <listitem> | |
| 2484 | + <para> | |
| 2485 | + Several methods to take | |
| 2486 | + <classname>PointerHolder<Buffer></classname> can now | |
| 2487 | + also accept <type>std::string</type> arguments. | |
| 2488 | + </para> | |
| 2489 | + </listitem> | |
| 2490 | + <listitem> | |
| 2491 | + <para> | |
| 2492 | + Many new convenience methods have been added to the library, | |
| 2493 | + most in <classname>QPDFObjectHandle</classname>. See | |
| 2494 | + <filename>ChangeLog</filename> for a full list. | |
| 2495 | + </para> | |
| 2496 | + </listitem> | |
| 2497 | + </itemizedlist> | |
| 2498 | + </listitem> | |
| 2499 | + </varlistentry> | |
| 2500 | + </variablelist> | |
| 2501 | + <variablelist> | |
| 2502 | + <varlistentry> | |
| 2090 | 2503 | <term>2.3.1: December 28, 2011</term> |
| 2091 | 2504 | <listitem> |
| 2092 | 2505 | <itemizedlist> |
| ... | ... | @@ -2728,4 +3141,47 @@ print "\n"; |
| 2728 | 3141 | </listitem> |
| 2729 | 3142 | </itemizedlist> |
| 2730 | 3143 | </appendix> |
| 3144 | + <appendix id="ref.upgrading-to-3.0"> | |
| 3145 | + <title>Upgrading to 3.0</title> | |
| 3146 | + <para> | |
| 3147 | + For the most part, the API for qpdf version 3.0 is backward | |
| 3148 | + compatible with versions 2.1 and later. There are two exceptions: | |
| 3149 | + <itemizedlist> | |
| 3150 | + <listitem> | |
| 3151 | + <para> | |
| 3152 | + The method | |
| 3153 | + <function>QPDFObjectHandle::replaceStreamData</function> that | |
| 3154 | + uses a <classname>StreamDataProvider</classname> to provide the | |
| 3155 | + stream data no longer takes a <varname>length</varname> | |
| 3156 | + parameter. While it would have been easy enough to keep the | |
| 3157 | + parameter for backward compatibility, in this case, the | |
| 3158 | + parameter was removed since this provides the user an | |
| 3159 | + opportunity to simplify the calling code. This method was | |
| 3160 | + introduced in version 2.2. At the time, the | |
| 3161 | + <varname>length</varname> parameter was required in order to | |
| 3162 | + ensure that calls to the stream data provider returned the same | |
| 3163 | + length for a specific stream every time they were invoked. In | |
| 3164 | + particular, the linearization code depends on this. Instead, | |
| 3165 | + qpdf 3.0 and newer check for that constraint explicitly. The | |
| 3166 | + first time the stream data provider is called for a specific | |
| 3167 | + stream, the actual length is saved, and subsequent calls are | |
| 3168 | + required to return the same number of bytes. This means the | |
| 3169 | + calling code no longer has to compute the length in advance, | |
| 3170 | + which can be a significant simplification. If your code fails | |
| 3171 | + to compile because of the extra argument and you don't want to | |
| 3172 | + make other changes to your code, just omit the argument. | |
| 3173 | + </para> | |
| 3174 | + </listitem> | |
| 3175 | + <listitem> | |
| 3176 | + <para> | |
| 3177 | + Many methods take <type>long long</type> instead of other | |
| 3178 | + integer types. Most if not all existing code should compile | |
| 3179 | + fine with this change since such parameters had always | |
| 3180 | + previously been smaller types. This change was required to | |
| 3181 | + support files larger than two gigabytes in size. | |
| 3182 | + </para> | |
| 3183 | + </listitem> | |
| 3184 | + </itemizedlist> | |
| 3185 | + </para> | |
| 3186 | + </appendix> | |
| 2731 | 3187 | </book> | ... | ... |
qpdf.spec
qpdf/qpdf.cc
| ... | ... | @@ -160,11 +160,6 @@ repeated multiple times. All non-page data (info, outlines, page numbers,\n\ |
| 160 | 160 | etc. are taken from the primary input file. To discard this, use --empty\n\ |
| 161 | 161 | as the primary input.\n\ |
| 162 | 162 | \n\ |
| 163 | -It is not presently possible to specify the same page from the same\n\ | |
| 164 | -file directly more than once, but you can make this work by specifying\n\ | |
| 165 | -two different paths to the same file (such as by putting ./ somewhere\n\ | |
| 166 | -in the path).\n\ | |
| 167 | -\n\ | |
| 168 | 163 | The page range is a set of numbers separated by commas, ranges of\n\ |
| 169 | 164 | numbers separated dashes, or combinations of those. The character\n\ |
| 170 | 165 | \"z\" represents the last page. Pages can appear in any order. Ranges\n\ | ... | ... |