Commit 49825e5cb67e589060de435f59203fa2f29b0476

Authored by Jay Berkenbilt
1 parent 8fe261d8

Add --split-pages option (fixes #30)

Showing 56 changed files with 1588 additions and 7 deletions
ChangeLog
1 1 2017-08-05 Jay Berkenbilt <ejb@ql.org>
2 2  
  3 + * Add --single-pages option to cause output to be written to a
  4 + separate file for each page rather than one big file.
  5 +
3 6 * Process --pages options earlier so that certain inspection
4 7 options, like --show-pages, can show the state after the merging
5 8 operations.
... ...
examples/pdf-split-pages.cc
1 1 //
2 2 // This is a stand-alone example of splitting a PDF into individual
3   -// pages. It is much faster than using the qpdf command-line tool to
4   -// split into separate files per page.
  3 +// pages. It does essentially the same thing that qpdf --split-pages
  4 +// does.
5 5 //
6 6  
7 7 #include <qpdf/QPDF.hh>
... ...
manual/qpdf-manual.xml
... ... @@ -354,6 +354,75 @@ make
354 354 </para>
355 355 </listitem>
356 356 </varlistentry>
  357 + <varlistentry>
  358 + <term><option>--single-pages</option></term>
  359 + <listitem>
  360 + <para>
  361 + Write each page to a separate output file. Output file names
  362 + are generated as follows:
  363 + <itemizedlist>
  364 + <listitem>
  365 + <para>
  366 + If the string <literal>%d</literal> appears in the output
  367 + file name, it is replaced with a zero-padded page number
  368 + starting from 1.
  369 + </para>
  370 + </listitem>
  371 + <listitem>
  372 + <para>
  373 + Otherwise, if the output file name ends in
  374 + <filename>.pdf</filename> (case insensitive), a zero-padded
  375 + page number, preceded by a dash, is inserted before the
  376 + file extension.
  377 + </para>
  378 + </listitem>
  379 + <listitem>
  380 + <para>
  381 + Otherwise, the file name is appended with a zero-padded
  382 + page number preceded by a dash.
  383 + </para>
  384 + </listitem>
  385 + </itemizedlist>
  386 + </para>
  387 + <para>
  388 + For example, if <filename>infile.pdf</filename> has 12 pages
  389 + <itemizedlist>
  390 + <listitem>
  391 + <para>
  392 + <command>qpdf infile.pdf %d-out</command> would generate
  393 + files <filename>01-out</filename> through
  394 + <filename>12-out</filename>
  395 + </para>
  396 + </listitem>
  397 + <listitem>
  398 + <para>
  399 + <command>qpdf infile.pdf outfile.pdf
  400 + --single-pages</command> would generate files
  401 + <filename>outfile-01.pdf</filename> through
  402 + <filename>outfile-12.pdf</filename>
  403 + </para>
  404 + </listitem>
  405 + <listitem>
  406 + <para>
  407 + <command>qpdf infile.pdf something.else</command> would generate
  408 + files <filename>something.else-01</filename> through
  409 + <filename>something.else-12</filename>
  410 + </para>
  411 + </listitem>
  412 + </itemizedlist>
  413 + </para>
  414 + <para>
  415 + Note that outlines, threads, and other global features of the
  416 + original PDF file are not preserved. For each page of output,
  417 + this option creates an empty PDF and copies a single page from
  418 + the output into it. If you require the global data, you will
  419 + have to run <command>qpdf</command> with the
  420 + <option>--pages</option> option once for each file. Using
  421 + <option>--single-pages</option> is much faster if you don't
  422 + require the global data.
  423 + </para>
  424 + </listitem>
  425 + </varlistentry>
357 426 </variablelist>
358 427 </para>
359 428 <para>
... ...
qpdf/qpdf.cc
... ... @@ -43,6 +43,7 @@ struct Options
43 43 password(0),
44 44 linearize(false),
45 45 decrypt(false),
  46 + single_pages(false),
46 47 copy_encryption(false),
47 48 encryption_file(0),
48 49 encryption_file_password(0),
... ... @@ -97,6 +98,7 @@ struct Options
97 98 char const* password;
98 99 bool linearize;
99 100 bool decrypt;
  101 + bool single_pages;
100 102 bool copy_encryption;
101 103 char const* encryption_file;
102 104 char const* encryption_file_password;
... ... @@ -204,6 +206,7 @@ Basic Options\n\
204 206 --encrypt options -- generate an encrypted file\n\
205 207 --decrypt remove any encryption on the file\n\
206 208 --pages options -- select specific pages from one or more files\n\
  209 +--single-pages write each output page to a separate file\n\
207 210 \n\
208 211 If none of --copy-encryption, --encrypt or --decrypt are given, qpdf will\n\
209 212 preserve any encryption data associated with a file.\n\
... ... @@ -213,6 +216,16 @@ parameters will be copied, including both user and owner passwords, even\n\
213 216 if the user password is used to open the other file. This works even if\n\
214 217 the owner password is not known.\n\
215 218 \n\
  219 +If --single-pages is specified, each page is written to a separate output\n\
  220 +file. File names are generated as follows:\n\
  221 +* If the string %d appears in the output file name, it is replaced with a\n\
  222 + zero-padded page number starting from 1\n\
  223 +* Otherwise, if the output file name ends in .pdf (case insensitive), a\n\
  224 + zero-padded page number, preceded by a dash, is inserted before the file\n\
  225 + extension\n\
  226 +* Otherwise, the file name is appended with a zero-padded page number\n\
  227 + preceded by a dash.\n\
  228 +\n\
216 229 \n\
217 230 Encryption Options\n\
218 231 ------------------\n\
... ... @@ -1321,6 +1334,10 @@ static void parse_options(int argc, char* argv[], Options&amp; o)
1321 1334 }
1322 1335 o.force_version = parameter;
1323 1336 }
  1337 + else if (strcmp(arg, "single-pages") == 0)
  1338 + {
  1339 + o.single_pages = true;
  1340 + }
1324 1341 else if (strcmp(arg, "deterministic-id") == 0)
1325 1342 {
1326 1343 o.deterministic_id = true;
... ... @@ -1433,6 +1450,12 @@ static void parse_options(int argc, char* argv[], Options&amp; o)
1433 1450 usage("no output file may be given for this option");
1434 1451 }
1435 1452  
  1453 + if (o.require_outfile && (strcmp(o.outfilename, "-") == 0) &&
  1454 + o.single_pages)
  1455 + {
  1456 + usage("--single-pages may not be used when writing to standard output");
  1457 + }
  1458 +
1436 1459 if (QUtil::same_file(o.infilename, o.outfilename))
1437 1460 {
1438 1461 QTC::TC("qpdf", "qpdf same file error");
... ... @@ -1954,13 +1977,59 @@ static void set_writer_options(QPDF&amp; pdf, Options&amp; o, QPDFWriter&amp; w)
1954 1977  
1955 1978 static void write_outfile(QPDF& pdf, Options& o)
1956 1979 {
1957   - if (strcmp(o.outfilename, "-") == 0)
  1980 + if (o.single_pages)
  1981 + {
  1982 + // Generate output file pattern
  1983 + std::string before;
  1984 + std::string after;
  1985 + size_t len = strlen(o.outfilename);
  1986 + char* num_spot = strstr(const_cast<char*>(o.outfilename), "%d");
  1987 + if (num_spot != 0)
  1988 + {
  1989 + QTC::TC("qpdf", "qpdf single-pages %d");
  1990 + before = std::string(o.outfilename, (num_spot - o.outfilename));
  1991 + after = num_spot + 2;
  1992 + }
  1993 + else if ((len >= 4) &&
  1994 + (QUtil::strcasecmp(o.outfilename + len - 4, ".pdf") == 0))
  1995 + {
  1996 + QTC::TC("qpdf", "qpdf single-pages .pdf");
  1997 + before = std::string(o.outfilename, len - 4) + "-";
  1998 + after = o.outfilename + len - 4;
  1999 + }
  2000 + else
  2001 + {
  2002 + QTC::TC("qpdf", "qpdf single-pages other");
  2003 + before = std::string(o.outfilename) + "-";
  2004 + }
  2005 +
  2006 + std::vector<QPDFObjectHandle> const& pages = pdf.getAllPages();
  2007 + int pageno_len = QUtil::int_to_string(pages.size()).length();
  2008 + int pageno = 0;
  2009 + for (std::vector<QPDFObjectHandle>::const_iterator iter = pages.begin();
  2010 + iter != pages.end(); ++iter)
  2011 + {
  2012 + QPDFObjectHandle page = *iter;
  2013 + std::string outfile =
  2014 + before + QUtil::int_to_string(++pageno, pageno_len) + after;
  2015 + QPDF outpdf;
  2016 + outpdf.emptyPDF();
  2017 + outpdf.addPage(page, false);
  2018 + QPDFWriter w(outpdf, outfile.c_str());
  2019 + set_writer_options(outpdf, o, w);
  2020 + w.write();
  2021 + }
  2022 + }
  2023 + else
1958 2024 {
1959   - o.outfilename = 0;
  2025 + if (strcmp(o.outfilename, "-") == 0)
  2026 + {
  2027 + o.outfilename = 0;
  2028 + }
  2029 + QPDFWriter w(pdf, o.outfilename);
  2030 + set_writer_options(pdf, o, w);
  2031 + w.write();
1960 2032 }
1961   - QPDFWriter w(pdf, o.outfilename);
1962   - set_writer_options(pdf, o, w);
1963   - w.write();
1964 2033 }
1965 2034  
1966 2035 int main(int argc, char* argv[])
... ...
qpdf/qpdf.testcov
... ... @@ -287,3 +287,6 @@ QPDF stream with non-space 0
287 287 qpdf same file error 0
288 288 qpdf read args from stdin 0
289 289 qpdf read args from file 0
  290 +qpdf single-pages %d 0
  291 +qpdf single-pages .pdf 0
  292 +qpdf single-pages other 0
... ...
qpdf/qtest/qpdf.test
... ... @@ -664,6 +664,61 @@ $td-&gt;runtest(&quot;combine show and --pages&quot;,
664 664  
665 665 show_ntests();
666 666 # ----------
  667 +$td->notify("--- Single Page ---");
  668 +# sp = single-pages
  669 +my @sp_cases = (
  670 + [11, '%d at beginning', '', '%d_single-out.zdf'],
  671 + [11, '%d at end', '--qdf', 'single-out.zdf_%d'],
  672 + [11, '%d in middle', '--encrypt u o 128 --', 'a-%d-single-out.zdf'],
  673 + [11, 'pdf extension', '', 'single-out.Pdf'],
  674 + [4, 'fallback', '--pages 11-pages.pdf 1-3 minimal.pdf --', 'single-out'],
  675 + );
  676 +$n_tests += 1;
  677 +for (@sp_cases)
  678 +{
  679 + $n_tests += 1 + $_->[0];
  680 +}
  681 +
  682 +$td->runtest("no single-pages to stdout",
  683 + {$td->COMMAND => "qpdf --single-pages 11-pages.pdf -"},
  684 + {$td->FILE => "single-pages-stdout.out", $td->EXIT_STATUS => 2},
  685 + $td->NORMALIZE_NEWLINES);
  686 +
  687 +foreach my $d (@sp_cases)
  688 +{
  689 + my ($n, $description, $xargs, $out) = @$d;
  690 + $td->runtest("single pages " . $description,
  691 + {$td->COMMAND =>
  692 + "qpdf --static-id --single-pages 11-pages.pdf" .
  693 + " $xargs $out"},
  694 + {$td->STRING => "", $td->EXIT_STATUS => 0});
  695 + my $pattern = $out;
  696 + my $nlen = length($n);
  697 + if ($pattern =~ m/\%d/)
  698 + {
  699 + $pattern =~ s/\%d/\%0${nlen}d/;
  700 + }
  701 + elsif ($pattern =~ m/\.pdf$/i)
  702 + {
  703 + $pattern =~ s/(\.pdf$)/-%0${nlen}d$1/i;
  704 + }
  705 + else
  706 + {
  707 + $pattern .= "-%0${nlen}d";
  708 + }
  709 + for (my $i = 1; $i <= $n; ++$i)
  710 + {
  711 + my $actual = sprintf($pattern, $i);
  712 + my $expected = $actual;
  713 + $expected =~ s/single-out/single-exp/;
  714 + $td->runtest("checkout output page $i",
  715 + {$td->FILE => $actual},
  716 + {$td->FILE => $expected});
  717 + }
  718 +}
  719 +
  720 +show_ntests();
  721 +# ----------
667 722 $td->notify("--- Numeric range parsing tests ---");
668 723 my @nrange_tests = (
669 724 [",5",
... ... @@ -2426,4 +2481,5 @@ sub get_md5_checksum
2426 2481 sub cleanup
2427 2482 {
2428 2483 system("rm -rf *.ps *.pnm ?.pdf ?.qdf *.enc* tif1 tif2 tiff-cache");
  2484 + system("rm -rf *single-out*");
2429 2485 }
... ...
qpdf/qtest/qpdf/01_single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/02_single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/03_single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/04_single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/05_single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/06_single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/07_single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/08_single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/09_single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/10_single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/11-pages.pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/11_single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/a-01-single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/a-02-single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/a-03-single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/a-04-single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/a-05-single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/a-06-single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/a-07-single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/a-08-single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/a-09-single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/a-10-single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/a-11-single-exp.zdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-01.Pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-02.Pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-03.Pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-04.Pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-05.Pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-06.Pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-07.Pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-08.Pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-09.Pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-1 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-10.Pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-11.Pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-2 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-3 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp-4 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/single-exp.zdf_01 0 → 100644
  1 +%PDF-1.3
  2 +%¿÷¢þ
  3 +%QDF-1.0
  4 +
  5 +%% Original object ID: 1 0
  6 +1 0 obj
  7 +<<
  8 + /Pages 2 0 R
  9 + /Type /Catalog
  10 +>>
  11 +endobj
  12 +
  13 +%% Original object ID: 2 0
  14 +2 0 obj
  15 +<<
  16 + /Count 1
  17 + /Kids [
  18 + 3 0 R
  19 + ]
  20 + /Type /Pages
  21 +>>
  22 +endobj
  23 +
  24 +%% Page 1
  25 +%% Original object ID: 3 0
  26 +3 0 obj
  27 +<<
  28 + /Contents 4 0 R
  29 + /MediaBox [
  30 + 0
  31 + 0
  32 + 612
  33 + 792
  34 + ]
  35 + /Parent 2 0 R
  36 + /Resources <<
  37 + /Font <<
  38 + /F1 6 0 R
  39 + >>
  40 + /ProcSet [
  41 + /PDF
  42 + /Text
  43 + ]
  44 + >>
  45 + /Type /Page
  46 +>>
  47 +endobj
  48 +
  49 +%% Contents for page 1
  50 +%% Original object ID: 4 0
  51 +4 0 obj
  52 +<<
  53 + /Length 5 0 R
  54 +>>
  55 +stream
  56 +BT /F1 15 Tf 72 720 Td (Original page 1) Tj ET
  57 +endstream
  58 +endobj
  59 +
  60 +5 0 obj
  61 +47
  62 +endobj
  63 +
  64 +%% Original object ID: 5 0
  65 +6 0 obj
  66 +<<
  67 + /BaseFont /Times-Roman
  68 + /Encoding /WinAnsiEncoding
  69 + /Subtype /Type1
  70 + /Type /Font
  71 +>>
  72 +endobj
  73 +
  74 +xref
  75 +0 7
  76 +0000000000 65535 f
  77 +0000000052 00000 n
  78 +0000000133 00000 n
  79 +0000000242 00000 n
  80 +0000000509 00000 n
  81 +0000000611 00000 n
  82 +0000000657 00000 n
  83 +trailer <<
  84 + /Root 1 0 R
  85 + /Size 7
  86 + /ID [<31415926535897932384626433832795><31415926535897932384626433832795>]
  87 +>>
  88 +startxref
  89 +765
  90 +%%EOF
... ...
qpdf/qtest/qpdf/single-exp.zdf_02 0 → 100644
  1 +%PDF-1.3
  2 +%¿÷¢þ
  3 +%QDF-1.0
  4 +
  5 +%% Original object ID: 1 0
  6 +1 0 obj
  7 +<<
  8 + /Pages 2 0 R
  9 + /Type /Catalog
  10 +>>
  11 +endobj
  12 +
  13 +%% Original object ID: 2 0
  14 +2 0 obj
  15 +<<
  16 + /Count 1
  17 + /Kids [
  18 + 3 0 R
  19 + ]
  20 + /Type /Pages
  21 +>>
  22 +endobj
  23 +
  24 +%% Page 1
  25 +%% Original object ID: 3 0
  26 +3 0 obj
  27 +<<
  28 + /Contents 4 0 R
  29 + /MediaBox [
  30 + 0
  31 + 0
  32 + 612
  33 + 792
  34 + ]
  35 + /Parent 2 0 R
  36 + /Resources <<
  37 + /Font <<
  38 + /F1 6 0 R
  39 + >>
  40 + /ProcSet [
  41 + /PDF
  42 + /Text
  43 + ]
  44 + >>
  45 + /Type /Page
  46 +>>
  47 +endobj
  48 +
  49 +%% Contents for page 1
  50 +%% Original object ID: 4 0
  51 +4 0 obj
  52 +<<
  53 + /Length 5 0 R
  54 +>>
  55 +stream
  56 +BT /F1 15 Tf 72 720 Td (Original page 2) Tj ET
  57 +endstream
  58 +endobj
  59 +
  60 +5 0 obj
  61 +47
  62 +endobj
  63 +
  64 +%% Original object ID: 5 0
  65 +6 0 obj
  66 +<<
  67 + /BaseFont /Times-Roman
  68 + /Encoding /WinAnsiEncoding
  69 + /Subtype /Type1
  70 + /Type /Font
  71 +>>
  72 +endobj
  73 +
  74 +xref
  75 +0 7
  76 +0000000000 65535 f
  77 +0000000052 00000 n
  78 +0000000133 00000 n
  79 +0000000242 00000 n
  80 +0000000509 00000 n
  81 +0000000611 00000 n
  82 +0000000657 00000 n
  83 +trailer <<
  84 + /Root 1 0 R
  85 + /Size 7
  86 + /ID [<31415926535897932384626433832795><31415926535897932384626433832795>]
  87 +>>
  88 +startxref
  89 +765
  90 +%%EOF
... ...
qpdf/qtest/qpdf/single-exp.zdf_03 0 → 100644
  1 +%PDF-1.3
  2 +%¿÷¢þ
  3 +%QDF-1.0
  4 +
  5 +%% Original object ID: 1 0
  6 +1 0 obj
  7 +<<
  8 + /Pages 2 0 R
  9 + /Type /Catalog
  10 +>>
  11 +endobj
  12 +
  13 +%% Original object ID: 2 0
  14 +2 0 obj
  15 +<<
  16 + /Count 1
  17 + /Kids [
  18 + 3 0 R
  19 + ]
  20 + /Type /Pages
  21 +>>
  22 +endobj
  23 +
  24 +%% Page 1
  25 +%% Original object ID: 3 0
  26 +3 0 obj
  27 +<<
  28 + /Contents 4 0 R
  29 + /MediaBox [
  30 + 0
  31 + 0
  32 + 612
  33 + 792
  34 + ]
  35 + /Parent 2 0 R
  36 + /Resources <<
  37 + /Font <<
  38 + /F1 6 0 R
  39 + >>
  40 + /ProcSet [
  41 + /PDF
  42 + /Text
  43 + ]
  44 + >>
  45 + /Type /Page
  46 +>>
  47 +endobj
  48 +
  49 +%% Contents for page 1
  50 +%% Original object ID: 4 0
  51 +4 0 obj
  52 +<<
  53 + /Length 5 0 R
  54 +>>
  55 +stream
  56 +BT /F1 15 Tf 72 720 Td (Original page 3) Tj ET
  57 +endstream
  58 +endobj
  59 +
  60 +5 0 obj
  61 +47
  62 +endobj
  63 +
  64 +%% Original object ID: 5 0
  65 +6 0 obj
  66 +<<
  67 + /BaseFont /Times-Roman
  68 + /Encoding /WinAnsiEncoding
  69 + /Subtype /Type1
  70 + /Type /Font
  71 +>>
  72 +endobj
  73 +
  74 +xref
  75 +0 7
  76 +0000000000 65535 f
  77 +0000000052 00000 n
  78 +0000000133 00000 n
  79 +0000000242 00000 n
  80 +0000000509 00000 n
  81 +0000000611 00000 n
  82 +0000000657 00000 n
  83 +trailer <<
  84 + /Root 1 0 R
  85 + /Size 7
  86 + /ID [<31415926535897932384626433832795><31415926535897932384626433832795>]
  87 +>>
  88 +startxref
  89 +765
  90 +%%EOF
... ...
qpdf/qtest/qpdf/single-exp.zdf_04 0 → 100644
  1 +%PDF-1.3
  2 +%¿÷¢þ
  3 +%QDF-1.0
  4 +
  5 +%% Original object ID: 1 0
  6 +1 0 obj
  7 +<<
  8 + /Pages 2 0 R
  9 + /Type /Catalog
  10 +>>
  11 +endobj
  12 +
  13 +%% Original object ID: 2 0
  14 +2 0 obj
  15 +<<
  16 + /Count 1
  17 + /Kids [
  18 + 3 0 R
  19 + ]
  20 + /Type /Pages
  21 +>>
  22 +endobj
  23 +
  24 +%% Page 1
  25 +%% Original object ID: 3 0
  26 +3 0 obj
  27 +<<
  28 + /Contents 4 0 R
  29 + /MediaBox [
  30 + 0
  31 + 0
  32 + 612
  33 + 792
  34 + ]
  35 + /Parent 2 0 R
  36 + /Resources <<
  37 + /Font <<
  38 + /F1 6 0 R
  39 + >>
  40 + /ProcSet [
  41 + /PDF
  42 + /Text
  43 + ]
  44 + >>
  45 + /Type /Page
  46 +>>
  47 +endobj
  48 +
  49 +%% Contents for page 1
  50 +%% Original object ID: 4 0
  51 +4 0 obj
  52 +<<
  53 + /Length 5 0 R
  54 +>>
  55 +stream
  56 +BT /F1 15 Tf 72 720 Td (Original page 4) Tj ET
  57 +endstream
  58 +endobj
  59 +
  60 +5 0 obj
  61 +47
  62 +endobj
  63 +
  64 +%% Original object ID: 5 0
  65 +6 0 obj
  66 +<<
  67 + /BaseFont /Times-Roman
  68 + /Encoding /WinAnsiEncoding
  69 + /Subtype /Type1
  70 + /Type /Font
  71 +>>
  72 +endobj
  73 +
  74 +xref
  75 +0 7
  76 +0000000000 65535 f
  77 +0000000052 00000 n
  78 +0000000133 00000 n
  79 +0000000242 00000 n
  80 +0000000509 00000 n
  81 +0000000611 00000 n
  82 +0000000657 00000 n
  83 +trailer <<
  84 + /Root 1 0 R
  85 + /Size 7
  86 + /ID [<31415926535897932384626433832795><31415926535897932384626433832795>]
  87 +>>
  88 +startxref
  89 +765
  90 +%%EOF
... ...
qpdf/qtest/qpdf/single-exp.zdf_05 0 → 100644
  1 +%PDF-1.3
  2 +%¿÷¢þ
  3 +%QDF-1.0
  4 +
  5 +%% Original object ID: 1 0
  6 +1 0 obj
  7 +<<
  8 + /Pages 2 0 R
  9 + /Type /Catalog
  10 +>>
  11 +endobj
  12 +
  13 +%% Original object ID: 2 0
  14 +2 0 obj
  15 +<<
  16 + /Count 1
  17 + /Kids [
  18 + 3 0 R
  19 + ]
  20 + /Type /Pages
  21 +>>
  22 +endobj
  23 +
  24 +%% Page 1
  25 +%% Original object ID: 3 0
  26 +3 0 obj
  27 +<<
  28 + /Contents 4 0 R
  29 + /MediaBox [
  30 + 0
  31 + 0
  32 + 612
  33 + 792
  34 + ]
  35 + /Parent 2 0 R
  36 + /Resources <<
  37 + /Font <<
  38 + /F1 6 0 R
  39 + >>
  40 + /ProcSet [
  41 + /PDF
  42 + /Text
  43 + ]
  44 + >>
  45 + /Type /Page
  46 +>>
  47 +endobj
  48 +
  49 +%% Contents for page 1
  50 +%% Original object ID: 4 0
  51 +4 0 obj
  52 +<<
  53 + /Length 5 0 R
  54 +>>
  55 +stream
  56 +BT /F1 15 Tf 72 720 Td (Original page 5) Tj ET
  57 +endstream
  58 +endobj
  59 +
  60 +5 0 obj
  61 +47
  62 +endobj
  63 +
  64 +%% Original object ID: 5 0
  65 +6 0 obj
  66 +<<
  67 + /BaseFont /Times-Roman
  68 + /Encoding /WinAnsiEncoding
  69 + /Subtype /Type1
  70 + /Type /Font
  71 +>>
  72 +endobj
  73 +
  74 +xref
  75 +0 7
  76 +0000000000 65535 f
  77 +0000000052 00000 n
  78 +0000000133 00000 n
  79 +0000000242 00000 n
  80 +0000000509 00000 n
  81 +0000000611 00000 n
  82 +0000000657 00000 n
  83 +trailer <<
  84 + /Root 1 0 R
  85 + /Size 7
  86 + /ID [<31415926535897932384626433832795><31415926535897932384626433832795>]
  87 +>>
  88 +startxref
  89 +765
  90 +%%EOF
... ...
qpdf/qtest/qpdf/single-exp.zdf_06 0 → 100644
  1 +%PDF-1.3
  2 +%¿÷¢þ
  3 +%QDF-1.0
  4 +
  5 +%% Original object ID: 1 0
  6 +1 0 obj
  7 +<<
  8 + /Pages 2 0 R
  9 + /Type /Catalog
  10 +>>
  11 +endobj
  12 +
  13 +%% Original object ID: 2 0
  14 +2 0 obj
  15 +<<
  16 + /Count 1
  17 + /Kids [
  18 + 3 0 R
  19 + ]
  20 + /Type /Pages
  21 +>>
  22 +endobj
  23 +
  24 +%% Page 1
  25 +%% Original object ID: 3 0
  26 +3 0 obj
  27 +<<
  28 + /Contents 4 0 R
  29 + /MediaBox [
  30 + 0
  31 + 0
  32 + 612
  33 + 792
  34 + ]
  35 + /Parent 2 0 R
  36 + /Resources <<
  37 + /Font <<
  38 + /F1 6 0 R
  39 + >>
  40 + /ProcSet [
  41 + /PDF
  42 + /Text
  43 + ]
  44 + >>
  45 + /Type /Page
  46 +>>
  47 +endobj
  48 +
  49 +%% Contents for page 1
  50 +%% Original object ID: 4 0
  51 +4 0 obj
  52 +<<
  53 + /Length 5 0 R
  54 +>>
  55 +stream
  56 +BT /F1 15 Tf 72 720 Td (Original page 6) Tj ET
  57 +endstream
  58 +endobj
  59 +
  60 +5 0 obj
  61 +47
  62 +endobj
  63 +
  64 +%% Original object ID: 5 0
  65 +6 0 obj
  66 +<<
  67 + /BaseFont /Times-Roman
  68 + /Encoding /WinAnsiEncoding
  69 + /Subtype /Type1
  70 + /Type /Font
  71 +>>
  72 +endobj
  73 +
  74 +xref
  75 +0 7
  76 +0000000000 65535 f
  77 +0000000052 00000 n
  78 +0000000133 00000 n
  79 +0000000242 00000 n
  80 +0000000509 00000 n
  81 +0000000611 00000 n
  82 +0000000657 00000 n
  83 +trailer <<
  84 + /Root 1 0 R
  85 + /Size 7
  86 + /ID [<31415926535897932384626433832795><31415926535897932384626433832795>]
  87 +>>
  88 +startxref
  89 +765
  90 +%%EOF
... ...
qpdf/qtest/qpdf/single-exp.zdf_07 0 → 100644
  1 +%PDF-1.3
  2 +%¿÷¢þ
  3 +%QDF-1.0
  4 +
  5 +%% Original object ID: 1 0
  6 +1 0 obj
  7 +<<
  8 + /Pages 2 0 R
  9 + /Type /Catalog
  10 +>>
  11 +endobj
  12 +
  13 +%% Original object ID: 2 0
  14 +2 0 obj
  15 +<<
  16 + /Count 1
  17 + /Kids [
  18 + 3 0 R
  19 + ]
  20 + /Type /Pages
  21 +>>
  22 +endobj
  23 +
  24 +%% Page 1
  25 +%% Original object ID: 3 0
  26 +3 0 obj
  27 +<<
  28 + /Contents 4 0 R
  29 + /MediaBox [
  30 + 0
  31 + 0
  32 + 612
  33 + 792
  34 + ]
  35 + /Parent 2 0 R
  36 + /Resources <<
  37 + /Font <<
  38 + /F1 6 0 R
  39 + >>
  40 + /ProcSet [
  41 + /PDF
  42 + /Text
  43 + ]
  44 + >>
  45 + /Type /Page
  46 +>>
  47 +endobj
  48 +
  49 +%% Contents for page 1
  50 +%% Original object ID: 4 0
  51 +4 0 obj
  52 +<<
  53 + /Length 5 0 R
  54 +>>
  55 +stream
  56 +BT /F1 15 Tf 72 720 Td (Original page 7) Tj ET
  57 +endstream
  58 +endobj
  59 +
  60 +5 0 obj
  61 +47
  62 +endobj
  63 +
  64 +%% Original object ID: 5 0
  65 +6 0 obj
  66 +<<
  67 + /BaseFont /Times-Roman
  68 + /Encoding /WinAnsiEncoding
  69 + /Subtype /Type1
  70 + /Type /Font
  71 +>>
  72 +endobj
  73 +
  74 +xref
  75 +0 7
  76 +0000000000 65535 f
  77 +0000000052 00000 n
  78 +0000000133 00000 n
  79 +0000000242 00000 n
  80 +0000000509 00000 n
  81 +0000000611 00000 n
  82 +0000000657 00000 n
  83 +trailer <<
  84 + /Root 1 0 R
  85 + /Size 7
  86 + /ID [<31415926535897932384626433832795><31415926535897932384626433832795>]
  87 +>>
  88 +startxref
  89 +765
  90 +%%EOF
... ...
qpdf/qtest/qpdf/single-exp.zdf_08 0 → 100644
  1 +%PDF-1.3
  2 +%¿÷¢þ
  3 +%QDF-1.0
  4 +
  5 +%% Original object ID: 1 0
  6 +1 0 obj
  7 +<<
  8 + /Pages 2 0 R
  9 + /Type /Catalog
  10 +>>
  11 +endobj
  12 +
  13 +%% Original object ID: 2 0
  14 +2 0 obj
  15 +<<
  16 + /Count 1
  17 + /Kids [
  18 + 3 0 R
  19 + ]
  20 + /Type /Pages
  21 +>>
  22 +endobj
  23 +
  24 +%% Page 1
  25 +%% Original object ID: 3 0
  26 +3 0 obj
  27 +<<
  28 + /Contents 4 0 R
  29 + /MediaBox [
  30 + 0
  31 + 0
  32 + 612
  33 + 792
  34 + ]
  35 + /Parent 2 0 R
  36 + /Resources <<
  37 + /Font <<
  38 + /F1 6 0 R
  39 + >>
  40 + /ProcSet [
  41 + /PDF
  42 + /Text
  43 + ]
  44 + >>
  45 + /Type /Page
  46 +>>
  47 +endobj
  48 +
  49 +%% Contents for page 1
  50 +%% Original object ID: 4 0
  51 +4 0 obj
  52 +<<
  53 + /Length 5 0 R
  54 +>>
  55 +stream
  56 +BT /F1 15 Tf 72 720 Td (Original page 8) Tj ET
  57 +endstream
  58 +endobj
  59 +
  60 +5 0 obj
  61 +47
  62 +endobj
  63 +
  64 +%% Original object ID: 5 0
  65 +6 0 obj
  66 +<<
  67 + /BaseFont /Times-Roman
  68 + /Encoding /WinAnsiEncoding
  69 + /Subtype /Type1
  70 + /Type /Font
  71 +>>
  72 +endobj
  73 +
  74 +xref
  75 +0 7
  76 +0000000000 65535 f
  77 +0000000052 00000 n
  78 +0000000133 00000 n
  79 +0000000242 00000 n
  80 +0000000509 00000 n
  81 +0000000611 00000 n
  82 +0000000657 00000 n
  83 +trailer <<
  84 + /Root 1 0 R
  85 + /Size 7
  86 + /ID [<31415926535897932384626433832795><31415926535897932384626433832795>]
  87 +>>
  88 +startxref
  89 +765
  90 +%%EOF
... ...
qpdf/qtest/qpdf/single-exp.zdf_09 0 → 100644
  1 +%PDF-1.3
  2 +%¿÷¢þ
  3 +%QDF-1.0
  4 +
  5 +%% Original object ID: 1 0
  6 +1 0 obj
  7 +<<
  8 + /Pages 2 0 R
  9 + /Type /Catalog
  10 +>>
  11 +endobj
  12 +
  13 +%% Original object ID: 2 0
  14 +2 0 obj
  15 +<<
  16 + /Count 1
  17 + /Kids [
  18 + 3 0 R
  19 + ]
  20 + /Type /Pages
  21 +>>
  22 +endobj
  23 +
  24 +%% Page 1
  25 +%% Original object ID: 3 0
  26 +3 0 obj
  27 +<<
  28 + /Contents 4 0 R
  29 + /MediaBox [
  30 + 0
  31 + 0
  32 + 612
  33 + 792
  34 + ]
  35 + /Parent 2 0 R
  36 + /Resources <<
  37 + /Font <<
  38 + /F1 6 0 R
  39 + >>
  40 + /ProcSet [
  41 + /PDF
  42 + /Text
  43 + ]
  44 + >>
  45 + /Type /Page
  46 +>>
  47 +endobj
  48 +
  49 +%% Contents for page 1
  50 +%% Original object ID: 4 0
  51 +4 0 obj
  52 +<<
  53 + /Length 5 0 R
  54 +>>
  55 +stream
  56 +BT /F1 15 Tf 72 720 Td (Original page 9) Tj ET
  57 +endstream
  58 +endobj
  59 +
  60 +5 0 obj
  61 +47
  62 +endobj
  63 +
  64 +%% Original object ID: 5 0
  65 +6 0 obj
  66 +<<
  67 + /BaseFont /Times-Roman
  68 + /Encoding /WinAnsiEncoding
  69 + /Subtype /Type1
  70 + /Type /Font
  71 +>>
  72 +endobj
  73 +
  74 +xref
  75 +0 7
  76 +0000000000 65535 f
  77 +0000000052 00000 n
  78 +0000000133 00000 n
  79 +0000000242 00000 n
  80 +0000000509 00000 n
  81 +0000000611 00000 n
  82 +0000000657 00000 n
  83 +trailer <<
  84 + /Root 1 0 R
  85 + /Size 7
  86 + /ID [<31415926535897932384626433832795><31415926535897932384626433832795>]
  87 +>>
  88 +startxref
  89 +765
  90 +%%EOF
... ...
qpdf/qtest/qpdf/single-exp.zdf_10 0 → 100644
  1 +%PDF-1.3
  2 +%¿÷¢þ
  3 +%QDF-1.0
  4 +
  5 +%% Original object ID: 1 0
  6 +1 0 obj
  7 +<<
  8 + /Pages 2 0 R
  9 + /Type /Catalog
  10 +>>
  11 +endobj
  12 +
  13 +%% Original object ID: 2 0
  14 +2 0 obj
  15 +<<
  16 + /Count 1
  17 + /Kids [
  18 + 3 0 R
  19 + ]
  20 + /Type /Pages
  21 +>>
  22 +endobj
  23 +
  24 +%% Page 1
  25 +%% Original object ID: 3 0
  26 +3 0 obj
  27 +<<
  28 + /Contents 4 0 R
  29 + /MediaBox [
  30 + 0
  31 + 0
  32 + 612
  33 + 792
  34 + ]
  35 + /Parent 2 0 R
  36 + /Resources <<
  37 + /Font <<
  38 + /F1 6 0 R
  39 + >>
  40 + /ProcSet [
  41 + /PDF
  42 + /Text
  43 + ]
  44 + >>
  45 + /Type /Page
  46 +>>
  47 +endobj
  48 +
  49 +%% Contents for page 1
  50 +%% Original object ID: 4 0
  51 +4 0 obj
  52 +<<
  53 + /Length 5 0 R
  54 +>>
  55 +stream
  56 +BT /F1 15 Tf 72 720 Td (Original page 10) Tj ET
  57 +endstream
  58 +endobj
  59 +
  60 +5 0 obj
  61 +48
  62 +endobj
  63 +
  64 +%% Original object ID: 5 0
  65 +6 0 obj
  66 +<<
  67 + /BaseFont /Times-Roman
  68 + /Encoding /WinAnsiEncoding
  69 + /Subtype /Type1
  70 + /Type /Font
  71 +>>
  72 +endobj
  73 +
  74 +xref
  75 +0 7
  76 +0000000000 65535 f
  77 +0000000052 00000 n
  78 +0000000133 00000 n
  79 +0000000242 00000 n
  80 +0000000509 00000 n
  81 +0000000612 00000 n
  82 +0000000658 00000 n
  83 +trailer <<
  84 + /Root 1 0 R
  85 + /Size 7
  86 + /ID [<31415926535897932384626433832795><31415926535897932384626433832795>]
  87 +>>
  88 +startxref
  89 +766
  90 +%%EOF
... ...
qpdf/qtest/qpdf/single-exp.zdf_11 0 → 100644
  1 +%PDF-1.3
  2 +%¿÷¢þ
  3 +%QDF-1.0
  4 +
  5 +%% Original object ID: 1 0
  6 +1 0 obj
  7 +<<
  8 + /Pages 2 0 R
  9 + /Type /Catalog
  10 +>>
  11 +endobj
  12 +
  13 +%% Original object ID: 2 0
  14 +2 0 obj
  15 +<<
  16 + /Count 1
  17 + /Kids [
  18 + 3 0 R
  19 + ]
  20 + /Type /Pages
  21 +>>
  22 +endobj
  23 +
  24 +%% Page 1
  25 +%% Original object ID: 3 0
  26 +3 0 obj
  27 +<<
  28 + /Contents 4 0 R
  29 + /MediaBox [
  30 + 0
  31 + 0
  32 + 612
  33 + 792
  34 + ]
  35 + /Parent 2 0 R
  36 + /Resources <<
  37 + /Font <<
  38 + /F1 6 0 R
  39 + >>
  40 + /ProcSet [
  41 + /PDF
  42 + /Text
  43 + ]
  44 + >>
  45 + /Type /Page
  46 +>>
  47 +endobj
  48 +
  49 +%% Contents for page 1
  50 +%% Original object ID: 4 0
  51 +4 0 obj
  52 +<<
  53 + /Length 5 0 R
  54 +>>
  55 +stream
  56 +BT /F1 15 Tf 72 720 Td (Original page 11) Tj ET
  57 +endstream
  58 +endobj
  59 +
  60 +5 0 obj
  61 +48
  62 +endobj
  63 +
  64 +%% Original object ID: 5 0
  65 +6 0 obj
  66 +<<
  67 + /BaseFont /Times-Roman
  68 + /Encoding /WinAnsiEncoding
  69 + /Subtype /Type1
  70 + /Type /Font
  71 +>>
  72 +endobj
  73 +
  74 +xref
  75 +0 7
  76 +0000000000 65535 f
  77 +0000000052 00000 n
  78 +0000000133 00000 n
  79 +0000000242 00000 n
  80 +0000000509 00000 n
  81 +0000000612 00000 n
  82 +0000000658 00000 n
  83 +trailer <<
  84 + /Root 1 0 R
  85 + /Size 7
  86 + /ID [<31415926535897932384626433832795><31415926535897932384626433832795>]
  87 +>>
  88 +startxref
  89 +766
  90 +%%EOF
... ...
qpdf/qtest/qpdf/single-pages-stdout.out 0 → 100644
  1 +
  2 +qpdf: --single-pages may not be used when writing to standard output
  3 +
  4 +Usage: qpdf [options] infile outfile
  5 +For detailed help, run qpdf --help
  6 +
... ...