Hello community, here is the log from the commit of package qpdf for openSUSE:Factory checked in at 2012-09-11 09:18:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qpdf (Old) and /work/SRC/openSUSE:Factory/.qpdf.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qpdf", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/qpdf/qpdf.changes 2012-08-12 15:28:01.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.qpdf.new/qpdf.changes 2012-09-11 09:18:57.000000000 +0200 @@ -1,0 +2,10 @@ +Fri Sep 7 12:00:40 UTC 2012 - [email protected] + +- Update to version 3.0.2 + * Calling QPDFWriter::setOutputMemory would result in a + segmentation fault from write() if setStaticID() was not used. + * New method call QPDFWriter::setExtraHeaderText to add text + * Make it so that you can write the same QPDF object through two + different QPDFWriter objects that both have linearization enabled. + +------------------------------------------------------------------- Old: ---- qpdf-3.0.1.tar.gz New: ---- qpdf-3.0.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qpdf.spec ++++++ --- /var/tmp/diff_new_pack.dnLCaO/_old 2012-09-11 09:18:58.000000000 +0200 +++ /var/tmp/diff_new_pack.dnLCaO/_new 2012-09-11 09:18:58.000000000 +0200 @@ -17,7 +17,7 @@ Name: qpdf -Version: 3.0.1 +Version: 3.0.2 Release: 0 Summary: Command-line tools and library for transforming PDF files License: Artistic-2.0 ++++++ qpdf-3.0.1.tar.gz -> qpdf-3.0.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/ChangeLog new/qpdf-3.0.2/ChangeLog --- old/qpdf-3.0.1/ChangeLog 2012-08-11 19:41:18.000000000 +0200 +++ new/qpdf-3.0.2/ChangeLog 2012-09-06 21:47:58.000000000 +0200 @@ -1,3 +1,23 @@ +2012-09-06 Jay Berkenbilt <[email protected]> + + * 3.0.2: release + + * Add new method QPDFWriter::setExtraHeaderText to add extra text, + such as application-specific comments, to near the beginning of a + PDF file. For linearized files, this appears after the + linearization parameter dictionary. For non-linearized files, it + appears right after the PDF header and non-ASCII comment. + + * Make it possible to write the same QPDF object with two + different QPDFWriter objects that have both called + setLinearization(true) by making private method + QPDF::calculateLinearizationData() properly initialize its state. + + * Bug fix: Writing after calling QPDFWriter::setOutputMemory() + would cause a segmentation fault because of an internal field not + being initialized, rendering that method useless. This has been + corrected. + 2012-08-11 Jay Berkenbilt <[email protected]> * 3.0.1: release diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/configure new/qpdf-3.0.2/configure --- old/qpdf-3.0.1/configure 2012-08-11 19:41:38.000000000 +0200 +++ new/qpdf-3.0.2/configure 2012-09-06 21:48:38.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for qpdf 3.0.1. +# Generated by GNU Autoconf 2.69 for qpdf 3.0.2. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ # Identity of this package. PACKAGE_NAME='qpdf' PACKAGE_TARNAME='qpdf' -PACKAGE_VERSION='3.0.1' -PACKAGE_STRING='qpdf 3.0.1' +PACKAGE_VERSION='3.0.2' +PACKAGE_STRING='qpdf 3.0.2' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1307,7 +1307,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures qpdf 3.0.1 to adapt to many kinds of systems. +\`configure' configures qpdf 3.0.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1372,7 +1372,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of qpdf 3.0.1:";; + short | recursive ) echo "Configuration of qpdf 3.0.2:";; esac cat <<\_ACEOF @@ -1506,7 +1506,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -qpdf configure 3.0.1 +qpdf configure 3.0.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2046,7 +2046,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by qpdf $as_me 3.0.1, which was +It was created by qpdf $as_me 3.0.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -16390,7 +16390,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by qpdf $as_me 3.0.1, which was +This file was extended by qpdf $as_me 3.0.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16456,7 +16456,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -qpdf config.status 3.0.1 +qpdf config.status 3.0.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/configure.ac new/qpdf-3.0.2/configure.ac --- old/qpdf-3.0.1/configure.ac 2012-08-11 19:41:18.000000000 +0200 +++ new/qpdf-3.0.2/configure.ac 2012-09-06 21:47:58.000000000 +0200 @@ -2,7 +2,7 @@ dnl This config.in requires autoconf 2.5 or greater. AC_PREREQ([2.68]) -AC_INIT([qpdf],[3.0.1]) +AC_INIT([qpdf],[3.0.2]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_FILES([autoconf.mk]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/doc/qpdf-manual.html new/qpdf-3.0.2/doc/qpdf-manual.html --- old/qpdf-3.0.1/doc/qpdf-manual.html 2012-08-11 19:41:43.000000000 +0200 +++ new/qpdf-3.0.2/doc/qpdf-manual.html 2012-09-06 21:48:44.000000000 +0200 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>QPDF Manual</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /></head><body><div class="book" title="QPDF Manual"><div class="titlepage"><div><div><h1 class="title"><a id="idm5528432"></a>QPDF Manual</h1></div><div><h2 class="subtitle">For QPDF Version 3.0.1, August 11, 2012</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Jay</span> <span class="surname">Berkenbilt</span></h3></div></div><div><p class="copyright">Copyright © 2005–2012 Jay Berkenbilt</p></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="preface"><a href="#acknowledgments">General Information</a></span></dt><dt><span class="chapter"><a href="#ref.overview">1. What is QPDF?</a></span></dt><dt><span class="chapter"><a href="#ref.installing">2. Building and Installing QPDF</a></span></dt><dd><dl><dt><span class="sect1"><a href="#ref.prerequisites">2.1. System Requirements</a></span></dt><dt><span class="sect1"><a href="#ref.building">2.2. Build Instructions</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ref.using">3. Running QPDF</a></span></dt><dd><dl><dt><span class="sect1"><a href="#ref.invocation">3.1. Basic Invocation</a></span></dt><dt><span class="sect1"><a href="#ref.basic-options">3.2. Basic Options</a></span></dt><dt><span class="sect1"><a href="#ref.encryption-options">3.3. Encryption Options</a></span></dt><dt><span class="sect1"><a href="#ref.page-selection">3.4. Page Selection Options</a></span></dt><dt><span class="sect1"><a href="#ref.advanced-transformation">3.5. Advanced Transformation Options</a></span></dt><dt><span class="sect1"><a href="#ref.testing-options">3.6. Testing, Inspection, and Debugging Options</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ref.qdf">4. QDF Mode</a></span></dt><dt><span class="chapter"><a href="#ref.using-library">5. Using the QPDF Library</a></span></dt><dt><span class="chapter"><a href="#ref.design">6. Design and Library Notes</a></span></dt><dd><dl><dt><span class="sect1"><a href="#ref.design.intro">6.1. Introduction</a></span></dt><dt><span class="sect1"><a href="#ref.design-goals">6.2. Design Goals</a></span></dt><dt><span class="sect1"><a href="#ref.encryption">6.3. Encryption</a></span></dt><dt><span class="sect1"><a href="#ref.adding-and-remove-pages">6.4. Adding and Removing Pages</a></span></dt><dt><span class="sect1"><a href="#ref.reserved-objects">6.5. Reserving Object Numbers</a></span></dt><dt><span class="sect1"><a href="#ref.foreign-objects">6.6. Copying Objects From Other PDF Files</a></span></dt><dt><span class="sect1"><a href="#ref.rewriting">6.7. Writing PDF Files</a></span></dt><dt><span class="sect1"><a href="#ref.filtered-streams">6.8. Filtered Streams</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ref.linearization">7. Linearization</a></span></dt><dd><dl><dt><span class="sect1"><a href="#ref.linearization-strategy">7.1. Basic Strategy for Linearization</a></span></dt><dt><span class="sect1"><a href="#ref.linearized.preparation">7.2. Preparing For Linearization</a></span></dt><dt><span class="sect1"><a href="#ref.optimization">7.3. Optimization</a></span></dt><dt><span class="sect1"><a href="#ref.linearization.writing">7.4. Writing Linearized Files</a></span></dt><dt><span class="sect1"><a href="#ref.linearization-data">7.5. Calculating Linearization Data</a></span></dt><dt><span class="sect1"><a href="#ref.linearization-issues">7.6. Known Issues with Linearization</a></span></dt><dt><span class="sect1"><a href="#ref.linearization-debugging">7.7. Debugging Note</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ref.object-and-xref-streams">8. Object and Cross-Reference Streams</a></span></dt><dd><dl><dt><span class="sect1"><a href="#ref.object-streams">8.1. Object Streams</a></span></dt><dt><span class="sect1"><a href="#ref.xref-streams">8.2. Cross-Reference Streams</a></span></dt><dd><dl><dt><span class="sect2"><a href="#ref.xref-stream-data">8.2.1. Cross-Reference Stream Data</a></span></dt></dl></dd><dt><span class="sect1"><a href="#ref.object-streams-linearization">8.3. Implications for Linearized Files</a></span></dt><dt><span class="sect1"><a href="#ref.object-stream-implementation">8.4. Implementation Notes</a></span></dt></dl></dd><dt><span class="appendix"><a href="#ref.release-notes">A. Release Notes</a></span></dt><dt><span class="appendix"><a href="#ref.upgrading-to-2.1">B. Upgrading from 2.0 to 2.1</a></span></dt><dt><span class="appendix"><a href="#ref.upgrading-to-3.0">C. Upgrading to 3.0</a></span></dt></dl></div><div class="preface" title="General Information"><div class="titlepage"><div><div><h2 class="title"><a id="acknowledgments"></a>General Information</h2></div></div></div><p> +<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>QPDF Manual</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /></head><body><div class="book" title="QPDF Manual"><div class="titlepage"><div><div><h1 class="title"><a id="idm5674192"></a>QPDF Manual</h1></div><div><h2 class="subtitle">For QPDF Version 3.0.2, September 6, 2012</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Jay</span> <span class="surname">Berkenbilt</span></h3></div></div><div><p class="copyright">Copyright © 2005–2012 Jay Berkenbilt</p></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="preface"><a href="#acknowledgments">General Information</a></span></dt><dt><span class="chapter"><a href="#ref.overview">1. What is QPDF?</a></span></dt><dt><span class="chapter"><a href="#ref.installing">2. Building and Installing QPDF</a></span></dt><dd><dl><dt><span class="sect1"><a href="#ref.prerequisites">2.1. System Requirements</a></span></dt><dt><span class="sect1"><a href="#ref.building">2.2. Build Instructions</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ref.using">3. Running QPDF</a></span></dt><dd><dl><dt><span class="sect1"><a href="#ref.invocation">3.1. Basic Invocation</a></span></dt><dt><span class="sect1"><a href="#ref.basic-options">3.2. Basic Options</a></span></dt><dt><span class="sect1"><a href="#ref.encryption-options">3.3. Encryption Options</a></span></dt><dt><span class="sect1"><a href="#ref.page-selection">3.4. Page Selection Options</a></span></dt><dt><span class="sect1"><a href="#ref.advanced-transformation">3.5. Advanced Transformation Options</a></span></dt><dt><span class="sect1"><a href="#ref.testing-options">3.6. Testing, Inspection, and Debugging Options</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ref.qdf">4. QDF Mode</a></span></dt><dt><span class="chapter"><a href="#ref.using-library">5. Using the QPDF Library</a></span></dt><dt><span class="chapter"><a href="#ref.design">6. Design and Library Notes</a></span></dt><dd><dl><dt><span class="sect1"><a href="#ref.design.intro">6.1. Introduction</a></span></dt><dt><span class="sect1"><a href="#ref.design-goals">6.2. Design Goals</a></span></dt><dt><span class="sect1"><a href="#ref.encryption">6.3. Encryption</a></span></dt><dt><span class="sect1"><a href="#ref.adding-and-remove-pages">6.4. Adding and Removing Pages</a></span></dt><dt><span class="sect1"><a href="#ref.reserved-objects">6.5. Reserving Object Numbers</a></span></dt><dt><span class="sect1"><a href="#ref.foreign-objects">6.6. Copying Objects From Other PDF Files</a></span></dt><dt><span class="sect1"><a href="#ref.rewriting">6.7. Writing PDF Files</a></span></dt><dt><span class="sect1"><a href="#ref.filtered-streams">6.8. Filtered Streams</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ref.linearization">7. Linearization</a></span></dt><dd><dl><dt><span class="sect1"><a href="#ref.linearization-strategy">7.1. Basic Strategy for Linearization</a></span></dt><dt><span class="sect1"><a href="#ref.linearized.preparation">7.2. Preparing For Linearization</a></span></dt><dt><span class="sect1"><a href="#ref.optimization">7.3. Optimization</a></span></dt><dt><span class="sect1"><a href="#ref.linearization.writing">7.4. Writing Linearized Files</a></span></dt><dt><span class="sect1"><a href="#ref.linearization-data">7.5. Calculating Linearization Data</a></span></dt><dt><span class="sect1"><a href="#ref.linearization-issues">7.6. Known Issues with Linearization</a></span></dt><dt><span class="sect1"><a href="#ref.linearization-debugging">7.7. Debugging Note</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ref.object-and-xref-streams">8. Object and Cross-Reference Streams</a></span></dt><dd><dl><dt><span class="sect1"><a href="#ref.object-streams">8.1. Object Streams</a></span></dt><dt><span class="sect1"><a href="#ref.xref-streams">8.2. Cross-Reference Streams</a></span></dt><dd><dl><dt><span class="sect2"><a href="#ref.xref-stream-data">8.2.1. Cross-Reference Stream Data</a></span></dt></dl></dd><dt><span class="sect1"><a href="#ref.object-streams-linearization">8.3. Implications for Linearized Files</a></span></dt><dt><span class="sect1"><a href="#ref.object-stream-implementation">8.4. Implementation Notes</a></span></dt></dl></dd><dt><span class="appendix"><a href="#ref.release-notes">A. Release Notes</a></span></dt><dt><span class="appendix"><a href="#ref.upgrading-to-2.1">B. Upgrading from 2.0 to 2.1</a></span></dt><dt><span class="appendix"><a href="#ref.upgrading-to-3.0">C. Upgrading to 3.0</a></span></dt></dl></div><div class="preface" title="General Information"><div class="titlepage"><div><div><h2 class="title"><a id="acknowledgments"></a>General Information</h2></div></div></div><p> QPDF is a program that does structural, content-preserving transformations on PDF files. QPDF's website is located at <a class="ulink" href="http://qpdf.sourceforge.net/" target="_top">http://qpdf.sourceforge.net/</a>. QPDF's source code is hosted on github at <a class="ulink" href="https://github.com/qpdf/qpdf" target="_top">https://github.com/qpdf/qpdf</a>. @@ -927,7 +927,7 @@ password-protected files. QPDF does not enforce encryption parameters and will treat user and owner passwords equivalently. Either password may be used to access an encrypted file. - <sup>[<a id="idp506000" href="#ftn.idp506000" class="footnote">1</a>]</sup> + <sup>[<a id="idp382528" href="#ftn.idp382528" class="footnote">1</a>]</sup> <code class="classname">QPDF</code> will allow recovery of a user password given an owner password. The input PDF file must be seekable. (Output files written by <code class="classname">QPDFWriter</code> need @@ -1222,7 +1222,7 @@ filter should write to whatever type of output is required. The <code class="classname">QPDF</code> class has an interface to write raw or filtered stream contents to a given pipeline. - </p></div><div class="footnotes"><br /><hr width="100" align="left" /><div class="footnote"><p><sup>[<a id="ftn.idp506000" href="#idp506000" class="para">1</a>] </sup> + </p></div><div class="footnotes"><br /><hr width="100" align="left" /><div class="footnote"><p><sup>[<a id="ftn.idp382528" href="#idp382528" class="para">1</a>] </sup> As pointed out earlier, the intention is not for qpdf to be used to bypass security on files. but as any open source PDF consumer may be easily modified to bypass basic PDF document security, @@ -1585,7 +1585,18 @@ </p></div></div><div class="appendix" title="Appendix A. Release Notes"><div class="titlepage"><div><div><h2 class="title"><a id="ref.release-notes"></a>Appendix A. Release Notes</h2></div></div></div><p> For a detailed list of changes, please see the file <code class="filename">ChangeLog</code> in the source distribution. - </p><div class="variablelist"><dl><dt><span class="term">3.0.1: August 11, 2012</span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p> + </p><div class="variablelist"><dl><dt><span class="term">3.0.2: September 6, 2012</span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p> + Bug fix: <code class="function">QPDFWriter::setOutputMemory</code> did + not work when not used with + <code class="function">QPDFWriter::setStaticID</code>, which made it + pretty much useless. This has been fixed. + </p></li><li class="listitem"><p> + New API call + <code class="function">QPDFWriter::setExtraHeaderText</code> inserts + additional text near the header of the PDF file. The intended + use case is to insert comments that may be consumed by a + downstream application, though other use cases may exist. + </p></li></ul></div></dd></dl></div><div class="variablelist"><dl><dt><span class="term">3.0.1: August 11, 2012</span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p> Version 3.0.0 included addition of files for <span class="command"><strong>pkg-config</strong></span>, but this was not mentioned in the release notes. The release notes for 3.0.0 were updated Files old/qpdf-3.0.1/doc/qpdf-manual.pdf and new/qpdf-3.0.2/doc/qpdf-manual.pdf differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/include/qpdf/QPDFWriter.hh new/qpdf-3.0.2/include/qpdf/QPDFWriter.hh --- old/qpdf-3.0.1/include/qpdf/QPDFWriter.hh 2012-08-11 19:41:18.000000000 +0200 +++ new/qpdf-3.0.2/include/qpdf/QPDFWriter.hh 2012-09-06 21:47:58.000000000 +0200 @@ -163,6 +163,18 @@ QPDF_DLL void forcePDFVersion(std::string const&); + // Provide additional text to insert in the PDF file somewhere + // near the beginning of the file. This can be used to add + // comments to the beginning of a PDF file, for example, if those + // comments are to be consumed by some other application. No + // checks are performed to ensure that the text inserted here is + // valid PDF. If you want to insert multiline comments, you will + // need to include \n in the string yourself and start each line + // with %. An extra newline will be appended if one is not + // already present at the end of your text. + QPDF_DLL + void setExtraHeaderText(std::string const&); + // Cause a static /ID value to be generated. Use only in test // suites. QPDF_DLL @@ -354,6 +366,7 @@ std::string id2; // trailer dictionary std::string min_pdf_version; std::string forced_pdf_version; + std::string extra_header_text; int encryption_dict_objid; std::string cur_data_key; std::list<PointerHolder<Pipeline> > to_delete; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/libqpdf/QPDF.cc new/qpdf-3.0.2/libqpdf/QPDF.cc --- old/qpdf-3.0.1/libqpdf/QPDF.cc 2012-08-11 19:41:18.000000000 +0200 +++ new/qpdf-3.0.2/libqpdf/QPDF.cc 2012-09-06 21:47:58.000000000 +0200 @@ -18,7 +18,7 @@ #include <qpdf/QPDF_Null.hh> #include <qpdf/QPDF_Dictionary.hh> -std::string QPDF::qpdf_version = "3.0.1"; +std::string QPDF::qpdf_version = "3.0.2"; static char const* EMPTY_PDF = "%PDF-1.3\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/libqpdf/QPDFWriter.cc new/qpdf-3.0.2/libqpdf/QPDFWriter.cc --- old/qpdf-3.0.1/libqpdf/QPDFWriter.cc 2012-08-11 19:41:18.000000000 +0200 +++ new/qpdf-3.0.2/libqpdf/QPDFWriter.cc 2012-09-06 21:47:58.000000000 +0200 @@ -120,6 +120,7 @@ void QPDFWriter::setOutputMemory() { + this->filename = "memory buffer"; this->buffer_pipeline = new Pl_Buffer("qpdf output"); to_delete.push_back(this->buffer_pipeline); initializePipelineStack(this->buffer_pipeline); @@ -195,6 +196,22 @@ } void +QPDFWriter::setExtraHeaderText(std::string const& text) +{ + this->extra_header_text = text; + if ((this->extra_header_text.length() > 0) && + (*(this->extra_header_text.rbegin()) != '\n')) + { + QTC::TC("qpdf", "QPDFWriter extra header text add newline"); + this->extra_header_text += "\n"; + } + else + { + QTC::TC("qpdf", "QPDFWriter extra header text no newline"); + } +} + +void QPDFWriter::setStaticID(bool val) { this->static_id = val; @@ -1492,7 +1509,7 @@ std::string seed; seed += QUtil::int_to_string((int)QUtil::get_current_time()); seed += " QPDF "; - seed += filename; + seed += this->filename; seed += " "; if (trailer.hasKey("/Info")) { @@ -1831,6 +1848,12 @@ // it really should be treated as binary. writeString("\n%\xbf\xf7\xa2\xfe\n"); writeStringQDF("%QDF-1.0\n\n"); + + // Note: do not write extra header text here. Linearized PDFs + // must include the entire linearization parameter dictionary + // within the first 1024 characters of the PDF file, so for + // linearized files, we have to write extra header text after the + // linearization parameter dictionary. } void @@ -2188,7 +2211,9 @@ // space to write real dictionary. 200 characters is enough // space if all numerical values in the parameter dictionary // that contain offsets are 20 digits long plus a few extra - // characters for safety. + // characters for safety. The entire linearization parameter + // dictionary must appear within the first 1024 characters of + // the file. qpdf_offset_t pos = this->pipeline->getCount(); openObject(lindict_id); @@ -2224,6 +2249,10 @@ writePad(spaces); writeString("\n"); + // If the user supplied any additional header text, write it + // here after the linearization parameter dictionary. + writeString(this->extra_header_text); + // Part 3: first page cross reference table and trailer. qpdf_offset_t first_xref_offset = this->pipeline->getCount(); @@ -2395,6 +2424,7 @@ // Start writing writeHeader(); + writeString(this->extra_header_text); // Put root first on queue. QPDFObjectHandle trailer = pdf.getTrailer(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/libqpdf/QPDF_linearization.cc new/qpdf-3.0.2/libqpdf/QPDF_linearization.cc --- old/qpdf-3.0.1/libqpdf/QPDF_linearization.cc 2012-08-11 19:41:18.000000000 +0200 +++ new/qpdf-3.0.2/libqpdf/QPDF_linearization.cc 2012-09-06 21:47:58.000000000 +0200 @@ -1241,6 +1241,16 @@ // * outlines: part 6 or 9 + this->part4.clear(); + this->part6.clear(); + this->part7.clear(); + this->part8.clear(); + this->part9.clear(); + this->c_linp = LinParameters(); + this->c_page_offset_data = CHPageOffset(); + this->c_shared_object_data = CHSharedObject(); + this->c_outline_data = HGeneric(); + QPDFObjectHandle root = getRoot(); bool outlines_in_first_page = false; QPDFObjectHandle pagemode = root.getKey("/PageMode"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/libqpdf/build.mk new/qpdf-3.0.2/libqpdf/build.mk --- old/qpdf-3.0.1/libqpdf/build.mk 2012-08-11 19:41:18.000000000 +0200 +++ new/qpdf-3.0.2/libqpdf/build.mk 2012-09-06 21:47:58.000000000 +0200 @@ -80,4 +80,4 @@ # * Otherwise, increment REVISION $(TARGETS_libqpdf): $(OBJS_libqpdf) - $(call makelib,$(OBJS_libqpdf),$@,$(LDFLAGS),$(LIBS),8,2,0) + $(call makelib,$(OBJS_libqpdf),$@,$(LDFLAGS),$(LIBS),9,0,1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/manual/qpdf-manual.xml new/qpdf-3.0.2/manual/qpdf-manual.xml --- old/qpdf-3.0.1/manual/qpdf-manual.xml 2012-08-11 19:41:18.000000000 +0200 +++ new/qpdf-3.0.2/manual/qpdf-manual.xml 2012-09-06 21:47:58.000000000 +0200 @@ -5,8 +5,8 @@ <!ENTITY mdash "—"> <!ENTITY ndash "–"> <!ENTITY nbsp " "> -<!ENTITY swversion "3.0.1"> -<!ENTITY lastreleased "August 11, 2012"> +<!ENTITY swversion "3.0.2"> +<!ENTITY lastreleased "September 6, 2012"> ]> <book> <bookinfo> @@ -2383,6 +2383,32 @@ </para> <variablelist> <varlistentry> + <term>3.0.2: September 6, 2012</term> + <listitem> + <itemizedlist> + <listitem> + <para> + Bug fix: <function>QPDFWriter::setOutputMemory</function> did + not work when not used with + <function>QPDFWriter::setStaticID</function>, which made it + pretty much useless. This has been fixed. + </para> + </listitem> + <listitem> + <para> + New API call + <function>QPDFWriter::setExtraHeaderText</function> inserts + additional text near the header of the PDF file. The intended + use case is to insert comments that may be consumed by a + downstream application, though other use cases may exist. + </para> + </listitem> + </itemizedlist> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> <term>3.0.1: August 11, 2012</term> <listitem> <itemizedlist> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/qpdf/qpdf.testcov new/qpdf-3.0.2/qpdf/qpdf.testcov --- old/qpdf-3.0.1/qpdf/qpdf.testcov 2012-08-11 19:41:18.000000000 +0200 +++ new/qpdf-3.0.2/qpdf/qpdf.testcov 2012-09-06 21:47:58.000000000 +0200 @@ -240,3 +240,5 @@ qpdf pages encryption password 0 QPDF_Tokenizer EOF reading token 0 QPDF_Tokenizer EOF reading appendable token 0 +QPDFWriter extra header text no newline 0 +QPDFWriter extra header text add newline 0 Files old/qpdf-3.0.1/qpdf/qtest/qpdf/extra-header-lin-newline.pdf and new/qpdf-3.0.2/qpdf/qtest/qpdf/extra-header-lin-newline.pdf differ Files old/qpdf-3.0.1/qpdf/qtest/qpdf/extra-header-lin-no-newline.pdf and new/qpdf-3.0.2/qpdf/qtest/qpdf/extra-header-lin-no-newline.pdf differ Files old/qpdf-3.0.1/qpdf/qtest/qpdf/extra-header-newline.pdf and new/qpdf-3.0.2/qpdf/qtest/qpdf/extra-header-newline.pdf differ Files old/qpdf-3.0.1/qpdf/qtest/qpdf/extra-header-no-newline.pdf and new/qpdf-3.0.2/qpdf/qtest/qpdf/extra-header-no-newline.pdf differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/qpdf/qtest/qpdf/test-32.out new/qpdf-3.0.2/qpdf/qtest/qpdf/test-32.out --- old/qpdf-3.0.1/qpdf/qtest/qpdf/test-32.out 1970-01-01 01:00:00.000000000 +0100 +++ new/qpdf-3.0.2/qpdf/qtest/qpdf/test-32.out 2012-09-06 21:47:58.000000000 +0200 @@ -0,0 +1,13 @@ +file: a.pdf +linearized: no +newline: no +file: b.pdf +linearized: yes +newline: no +file: c.pdf +linearized: no +newline: yes +file: d.pdf +linearized: yes +newline: yes +test 32 done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/qpdf/qtest/qpdf.test new/qpdf-3.0.2/qpdf/qtest/qpdf.test --- old/qpdf-3.0.1/qpdf/qtest/qpdf.test 2012-08-11 19:41:18.000000000 +0200 +++ new/qpdf-3.0.2/qpdf/qtest/qpdf.test 2012-09-06 21:47:58.000000000 +0200 @@ -149,7 +149,7 @@ $td->NORMALIZE_NEWLINES); # ---------- $td->notify("--- Miscellaneous Tests ---"); -$n_tests += 47; +$n_tests += 53; $td->runtest("qpdf version", {$td->COMMAND => "qpdf --version"}, @@ -322,6 +322,11 @@ $td->runtest("check output", {$td->FILE => "a.pdf"}, {$td->FILE => "test14-out.pdf"}); +# Test 14 also exercises writing to memory without static ID. +$td->runtest("check non-static ID version", + {$td->COMMAND => "./diff-ignore-ID-version a.pdf b.pdf"}, + {$td->STRING => "okay\n", $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); $td->runtest("C API info key functions", {$td->COMMAND => "qpdf-ctest 16 minimal.pdf '' a.pdf"}, @@ -382,6 +387,22 @@ {$td->COMMAND => "qpdf --check eof-reading-token.pdf"}, {$td->FILE => "eof-reading-token.out", $td->EXIT_STATUS => 0}, $td->NORMALIZE_NEWLINES); +$td->runtest("extra header text", + {$td->COMMAND => "test_driver 32 minimal.pdf"}, + {$td->FILE => "test-32.out", $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); +$td->runtest("check output", + {$td->FILE => "a.pdf"}, + {$td->FILE => "extra-header-no-newline.pdf"}); +$td->runtest("check output", + {$td->FILE => "b.pdf"}, + {$td->FILE => "extra-header-lin-no-newline.pdf"}); +$td->runtest("check output", + {$td->FILE => "c.pdf"}, + {$td->FILE => "extra-header-newline.pdf"}); +$td->runtest("check output", + {$td->FILE => "d.pdf"}, + {$td->FILE => "extra-header-lin-newline.pdf"}); show_ntests(); # ---------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/qpdf/test_driver.cc new/qpdf-3.0.2/qpdf/test_driver.cc --- old/qpdf-3.0.1/qpdf/test_driver.cc 2012-08-11 19:41:18.000000000 +0200 +++ new/qpdf-3.0.2/qpdf/test_driver.cc 2012-09-06 21:47:58.000000000 +0200 @@ -646,17 +646,22 @@ } // Exercise writing to memory buffer - QPDFWriter w(pdf); - w.setOutputMemory(); - w.setStaticID(true); - w.setStreamDataMode(qpdf_s_preserve); - w.write(); - Buffer* b = w.getBuffer(); - FILE* f = QUtil::fopen_wrapper(std::string("open a.pdf"), - fopen("a.pdf", "wb")); - fwrite(b->getBuffer(), b->getSize(), 1, f); - fclose(f); - delete b; + for (int i = 0; i < 2; ++i) + { + QPDFWriter w(pdf); + w.setOutputMemory(); + // Exercise setOutputMemory with and without static ID + w.setStaticID(i == 0); + w.setStreamDataMode(qpdf_s_preserve); + w.write(); + Buffer* b = w.getBuffer(); + std::string const filename = (i == 0 ? "a.pdf" : "b.pdf"); + FILE* f = QUtil::fopen_wrapper("open " + filename, + fopen(filename.c_str(), "wb")); + fwrite(b->getBuffer(), b->getSize(), 1, f); + fclose(f); + delete b; + } } else if (n == 15) { @@ -1086,6 +1091,27 @@ << std::endl; } } + else if (n == 32) + { + // Extra header text + char const* filenames[] = {"a.pdf", "b.pdf", "c.pdf", "d.pdf"}; + for (int i = 0; i < 4; ++i) + { + bool linearized = ((i & 1) != 0); + bool newline = ((i & 2) != 0); + QPDFWriter w(pdf, filenames[i]); + w.setStaticID(true); + std::cout + << "file: " << filenames[i] << std::endl + << "linearized: " << (linearized ? "yes" : "no") << std::endl + << "newline: " << (newline ? "yes" : "no") << std::endl; + w.setLinearization(linearized); + w.setExtraHeaderText(newline + ? "%% Comment with newline\n" + : "%% Comment\n% No newline"); + w.write(); + } + } else { throw std::runtime_error(std::string("invalid test ") + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qpdf-3.0.1/qpdf.spec new/qpdf-3.0.2/qpdf.spec --- old/qpdf-3.0.1/qpdf.spec 2012-08-11 19:41:18.000000000 +0200 +++ new/qpdf-3.0.2/qpdf.spec 2012-09-06 21:47:58.000000000 +0200 @@ -1,6 +1,6 @@ Summary: Command-line tools and library for transforming PDF files Name: qpdf -Version: 3.0.1 +Version: 3.0.2 Release: 1%{?dist} License: Artistic Group: System Environment/Libraries -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
