Commit 4f3b89991be466b77d1be2ab4fe0dc3f9228a17e

Authored by Jay Berkenbilt
1 parent b76b73b2

placeFormXObject: allow control of shrink/expand (fixes #409)

ChangeLog
  1 +2020-04-03 Jay Berkenbilt <ejb@ql.org>
  2 +
  3 + * Add two extra optional arguments to
  4 + QPDFPageObjectHelper::placeFormXObject to control whether the
  5 + placed item is allowed to be shrunk or expanded to fit within or
  6 + maximally fill the destination rectangle. Prior to this change,
  7 + placeFormXObject might shrink it but would never expand it.
  8 +
1 9 2020-04-02 Jay Berkenbilt <ejb@ql.org>
2 10  
3 11 * Add method QPDFObjectHandle::unsafeShallowCopy for copying only
... ...
include/qpdf/QPDFPageObjectHelper.hh
... ... @@ -209,27 +209,33 @@ class QPDFPageObjectHelper: public QPDFObjectHelper
209 209  
210 210 // Return content stream text that will place the given form
211 211 // XObject (fo) using the resource name "name" on this page
212   - // centered within the given rectangle and shrunk to fit if
213   - // necessary. If invert_transformations is true, the effect of any
214   - // rotation (/Rotate) and scaling (/UserUnit) applied to the
215   - // current page will be inverted in the form XObject placement.
216   - // This will cause the form XObject's absolute orientation to be
217   - // preserved. You could overlay one page on another by calling
218   - // getFormXObjectForPage on the original page,
219   - // QPDFObjectHandle::getUniqueResourceName on the destination
220   - // page's Resources dictionary to generate a name for the
221   - // resulting object, and calling placeFormXObject on the
  212 + // centered within the given rectangle. If invert_transformations
  213 + // is true, the effect of any rotation (/Rotate) and scaling
  214 + // (/UserUnit) applied to the current page will be inverted in the
  215 + // form XObject placement. This will cause the form XObject's
  216 + // absolute orientation to be preserved. You could overlay one
  217 + // page on another by calling getFormXObjectForPage on the
  218 + // original page, QPDFObjectHandle::getUniqueResourceName on the
  219 + // destination page's Resources dictionary to generate a name for
  220 + // the resulting object, and calling placeFormXObject on the
222 221 // destination page. Then insert the new fo (or, if it comes from
223 222 // a different file, the result of calling copyForeignObject on
224 223 // it) into the resources dictionary using name, and append or
225 224 // prepend the content to the page's content streams. See the
226 225 // overlay/underlay code in qpdf.cc or
227   - // examples/pdf-overlay-page.cc for an example.
  226 + // examples/pdf-overlay-page.cc for an example. From qpdf 10.0.0,
  227 + // the allow_shrink and allow_expand parameters control whether
  228 + // the form XObject is allowed to be shrunk or expanded to stay
  229 + // within or maximally fill the destination rectangle. The default
  230 + // values are for backward compatibility with the pre-10.0.0
  231 + // behavior.
228 232 QPDF_DLL
229 233 std::string placeFormXObject(
230 234 QPDFObjectHandle fo, std::string const& name,
231 235 QPDFObjectHandle::Rectangle rect,
232   - bool invert_transformations = true);
  236 + bool invert_transformations = true,
  237 + bool allow_shrink = true,
  238 + bool allow_expand = false);
233 239  
234 240 private:
235 241 static void
... ...
libqpdf/QPDFPageObjectHelper.cc
... ... @@ -724,11 +724,12 @@ std::string
724 724 QPDFPageObjectHelper::placeFormXObject(
725 725 QPDFObjectHandle fo, std::string const& name,
726 726 QPDFObjectHandle::Rectangle rect,
727   - bool invert_transformations)
  727 + bool invert_transformations,
  728 + bool allow_shrink, bool allow_expand)
728 729 {
729 730 // Calculate the transformation matrix that will place the given
730   - // form XObject fully inside the given rectangle, shrinking and
731   - // centering if needed.
  731 + // form XObject fully inside the given rectangle, center and
  732 + // shrinking or expanding as needed if requested.
732 733  
733 734 // When rendering a form XObject, the transformation in the
734 735 // graphics state (cm) is applied first (of course -- when it is
... ... @@ -797,7 +798,17 @@ QPDFPageObjectHelper::placeFormXObject(
797 798 double scale = (xscale < yscale ? xscale : yscale);
798 799 if (scale > 1.0)
799 800 {
800   - scale = 1.0;
  801 + if (! allow_expand)
  802 + {
  803 + scale = 1.0;
  804 + }
  805 + }
  806 + else if (scale < 1.0)
  807 + {
  808 + if (! allow_shrink)
  809 + {
  810 + scale = 1.0;
  811 + }
801 812 }
802 813  
803 814 // Step 2: figure out what translation is required to get the
... ...
qpdf/qtest/qpdf.test
... ... @@ -412,7 +412,7 @@ foreach my $i (@choice_values)
412 412 show_ntests();
413 413 # ----------
414 414 $td->notify("--- Form XObject, underlay, overlay ---");
415   -$n_tests += 10;
  415 +$n_tests += 18;
416 416  
417 417 $td->runtest("form xobject creation",
418 418 {$td->COMMAND => "test_driver 55 fxo-red.pdf"},
... ... @@ -433,6 +433,19 @@ foreach (my $i = 56; $i &lt;= 59; ++$i)
433 433 {$td->FILE => "a.pdf"},
434 434 {$td->FILE => "fx-overlay-$i.pdf"});
435 435 }
  436 +foreach (my $i = 64; $i <= 67; ++$i)
  437 +{
  438 + # See comments in test_driver.cc for a verbal description of what
  439 + # the resulting files should look like.
  440 + $td->runtest("overlay shrink/expand",
  441 + {$td->COMMAND =>
  442 + "test_driver $i fxo-bigsmall.pdf fxo-smallbig.pdf"},
  443 + {$td->STRING => "test $i done\n", $td->EXIT_STATUS => 0},
  444 + $td->NORMALIZE_NEWLINES);
  445 + $td->runtest("compare files",
  446 + {$td->FILE => "a.pdf"},
  447 + {$td->FILE => "fx-overlay-$i.pdf"});
  448 +}
436 449  
437 450 my @uo_cases = (
438 451 '--underlay fxo-green.pdf --repeat=z --to=1-14 --' .
... ...
qpdf/qtest/qpdf/fx-overlay-64.pdf 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 2
  17 + /Kids [
  18 + 3 0 R
  19 + 4 0 R
  20 + ]
  21 + /Type /Pages
  22 +>>
  23 +endobj
  24 +
  25 +%% Page 1
  26 +%% Original object ID: 3 0
  27 +3 0 obj
  28 +<<
  29 + /Contents [
  30 + 5 0 R
  31 + 7 0 R
  32 + 9 0 R
  33 + ]
  34 + /MediaBox [
  35 + 0
  36 + 0
  37 + 612
  38 + 792
  39 + ]
  40 + /Parent 2 0 R
  41 + /Resources <<
  42 + /Font <<
  43 + /F1 11 0 R
  44 + >>
  45 + /ProcSet 12 0 R
  46 + /XObject <<
  47 + /Fx1 13 0 R
  48 + >>
  49 + >>
  50 + /Type /Page
  51 +>>
  52 +endobj
  53 +
  54 +%% Page 2
  55 +%% Original object ID: 4 0
  56 +4 0 obj
  57 +<<
  58 + /Contents [
  59 + 15 0 R
  60 + 17 0 R
  61 + 19 0 R
  62 + ]
  63 + /MediaBox [
  64 + 0
  65 + 0
  66 + 306
  67 + 396
  68 + ]
  69 + /Parent 2 0 R
  70 + /Resources <<
  71 + /Font <<
  72 + /F1 21 0 R
  73 + >>
  74 + /ProcSet 22 0 R
  75 + /XObject <<
  76 + /Fx1 23 0 R
  77 + >>
  78 + >>
  79 + /Type /Page
  80 +>>
  81 +endobj
  82 +
  83 +%% Contents for page 1
  84 +%% Original object ID: 16 0
  85 +5 0 obj
  86 +<<
  87 + /Length 6 0 R
  88 +>>
  89 +stream
  90 +q
  91 +endstream
  92 +endobj
  93 +
  94 +6 0 obj
  95 +2
  96 +endobj
  97 +
  98 +%% Contents for page 1
  99 +%% Original object ID: 5 0
  100 +7 0 obj
  101 +<<
  102 + /Length 8 0 R
  103 +>>
  104 +stream
  105 +1 .5 0 RG
  106 +1 .5 0 rg
  107 +BT
  108 + /F1 24 Tf
  109 + 72 690 Td
  110 + (big) Tj
  111 +ET
  112 +5 w
  113 +0 0 612 792 re s
  114 +246 396 60 60 re f
  115 +endstream
  116 +endobj
  117 +
  118 +8 0 obj
  119 +101
  120 +endobj
  121 +
  122 +%% Contents for page 1
  123 +%% Original object ID: 17 0
  124 +9 0 obj
  125 +<<
  126 + /Length 10 0 R
  127 +>>
  128 +stream
  129 +
  130 +Q
  131 +q
  132 +1.00000 0.00000 0.00000 1.00000 153.00000 198.00000 cm
  133 +/Fx1 Do
  134 +Q
  135 +endstream
  136 +endobj
  137 +
  138 +10 0 obj
  139 +70
  140 +endobj
  141 +
  142 +%% Original object ID: 7 0
  143 +11 0 obj
  144 +<<
  145 + /BaseFont /Helvetica
  146 + /Encoding /WinAnsiEncoding
  147 + /Name /F1
  148 + /Subtype /Type1
  149 + /Type /Font
  150 +>>
  151 +endobj
  152 +
  153 +%% Original object ID: 8 0
  154 +12 0 obj
  155 +[
  156 + /PDF
  157 + /Text
  158 +]
  159 +endobj
  160 +
  161 +%% Original object ID: 13 0
  162 +13 0 obj
  163 +<<
  164 + /BBox [
  165 + 0
  166 + 0
  167 + 306
  168 + 396
  169 + ]
  170 + /Resources <<
  171 + /Font <<
  172 + /F1 25 0 R
  173 + >>
  174 + /ProcSet 26 0 R
  175 + >>
  176 + /Subtype /Form
  177 + /Type /XObject
  178 + /Length 14 0 R
  179 +>>
  180 +stream
  181 +.5 0 .5 RG
  182 +.5 0 .5 rg
  183 +BT
  184 + /F1 24 Tf
  185 + 36 345 Td
  186 + (small) Tj
  187 +ET
  188 +5 w
  189 +0 0 306 396 re s
  190 +153 198 30 30 re f
  191 +endstream
  192 +endobj
  193 +
  194 +14 0 obj
  195 +105
  196 +endobj
  197 +
  198 +%% Contents for page 2
  199 +%% Original object ID: 21 0
  200 +15 0 obj
  201 +<<
  202 + /Length 16 0 R
  203 +>>
  204 +stream
  205 +q
  206 +endstream
  207 +endobj
  208 +
  209 +16 0 obj
  210 +2
  211 +endobj
  212 +
  213 +%% Contents for page 2
  214 +%% Original object ID: 9 0
  215 +17 0 obj
  216 +<<
  217 + /Length 18 0 R
  218 +>>
  219 +stream
  220 +1 .5 0 RG
  221 +1 .5 0 rg
  222 +BT
  223 + /F1 24 Tf
  224 + 36 345 Td
  225 + (small) Tj
  226 +ET
  227 +5 w
  228 +0 0 306 396 re s
  229 +153 198 30 30 re f
  230 +endstream
  231 +endobj
  232 +
  233 +18 0 obj
  234 +103
  235 +endobj
  236 +
  237 +%% Contents for page 2
  238 +%% Original object ID: 22 0
  239 +19 0 obj
  240 +<<
  241 + /Length 20 0 R
  242 +>>
  243 +stream
  244 +
  245 +Q
  246 +q
  247 +1.00000 0.00000 0.00000 1.00000 -153.00000 -198.00000 cm
  248 +/Fx1 Do
  249 +Q
  250 +endstream
  251 +endobj
  252 +
  253 +20 0 obj
  254 +72
  255 +endobj
  256 +
  257 +%% Original object ID: 11 0
  258 +21 0 obj
  259 +<<
  260 + /BaseFont /Helvetica
  261 + /Encoding /WinAnsiEncoding
  262 + /Name /F1
  263 + /Subtype /Type1
  264 + /Type /Font
  265 +>>
  266 +endobj
  267 +
  268 +%% Original object ID: 12 0
  269 +22 0 obj
  270 +[
  271 + /PDF
  272 + /Text
  273 +]
  274 +endobj
  275 +
  276 +%% Original object ID: 18 0
  277 +23 0 obj
  278 +<<
  279 + /BBox [
  280 + 0
  281 + 0
  282 + 612
  283 + 792
  284 + ]
  285 + /Resources <<
  286 + /Font <<
  287 + /F1 27 0 R
  288 + >>
  289 + /ProcSet 28 0 R
  290 + >>
  291 + /Subtype /Form
  292 + /Type /XObject
  293 + /Length 24 0 R
  294 +>>
  295 +stream
  296 +.5 0 .5 RG
  297 +.5 0 .5 rg
  298 +BT
  299 + /F1 24 Tf
  300 + 72 690 Td
  301 + (big) Tj
  302 +ET
  303 +5 w
  304 +0 0 612 792 re s
  305 +246 396 60 60 re f
  306 +endstream
  307 +endobj
  308 +
  309 +24 0 obj
  310 +103
  311 +endobj
  312 +
  313 +%% Original object ID: 14 0
  314 +25 0 obj
  315 +<<
  316 + /BaseFont /Helvetica
  317 + /Encoding /WinAnsiEncoding
  318 + /Name /F1
  319 + /Subtype /Type1
  320 + /Type /Font
  321 +>>
  322 +endobj
  323 +
  324 +%% Original object ID: 15 0
  325 +26 0 obj
  326 +[
  327 + /PDF
  328 + /Text
  329 +]
  330 +endobj
  331 +
  332 +%% Original object ID: 19 0
  333 +27 0 obj
  334 +<<
  335 + /BaseFont /Helvetica
  336 + /Encoding /WinAnsiEncoding
  337 + /Name /F1
  338 + /Subtype /Type1
  339 + /Type /Font
  340 +>>
  341 +endobj
  342 +
  343 +%% Original object ID: 20 0
  344 +28 0 obj
  345 +[
  346 + /PDF
  347 + /Text
  348 +]
  349 +endobj
  350 +
  351 +xref
  352 +0 29
  353 +0000000000 65535 f
  354 +0000000052 00000 n
  355 +0000000133 00000 n
  356 +0000000252 00000 n
  357 +0000000554 00000 n
  358 +0000000873 00000 n
  359 +0000000930 00000 n
  360 +0000000998 00000 n
  361 +0000001154 00000 n
  362 +0000001225 00000 n
  363 +0000001351 00000 n
  364 +0000001398 00000 n
  365 +0000001544 00000 n
  366 +0000001608 00000 n
  367 +0000001924 00000 n
  368 +0000001996 00000 n
  369 +0000002055 00000 n
  370 +0000002124 00000 n
  371 +0000002284 00000 n
  372 +0000002356 00000 n
  373 +0000002485 00000 n
  374 +0000002533 00000 n
  375 +0000002680 00000 n
  376 +0000002744 00000 n
  377 +0000003058 00000 n
  378 +0000003107 00000 n
  379 +0000003254 00000 n
  380 +0000003318 00000 n
  381 +0000003465 00000 n
  382 +trailer <<
  383 + /Root 1 0 R
  384 + /Size 29
  385 + /ID [<4866f3ccc81fb28dc4a27f0f976ce937><31415926535897932384626433832795>]
  386 +>>
  387 +startxref
  388 +3501
  389 +%%EOF
... ...
qpdf/qtest/qpdf/fx-overlay-65.pdf 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 2
  17 + /Kids [
  18 + 3 0 R
  19 + 4 0 R
  20 + ]
  21 + /Type /Pages
  22 +>>
  23 +endobj
  24 +
  25 +%% Page 1
  26 +%% Original object ID: 3 0
  27 +3 0 obj
  28 +<<
  29 + /Contents [
  30 + 5 0 R
  31 + 7 0 R
  32 + 9 0 R
  33 + ]
  34 + /MediaBox [
  35 + 0
  36 + 0
  37 + 612
  38 + 792
  39 + ]
  40 + /Parent 2 0 R
  41 + /Resources <<
  42 + /Font <<
  43 + /F1 11 0 R
  44 + >>
  45 + /ProcSet 12 0 R
  46 + /XObject <<
  47 + /Fx1 13 0 R
  48 + >>
  49 + >>
  50 + /Type /Page
  51 +>>
  52 +endobj
  53 +
  54 +%% Page 2
  55 +%% Original object ID: 4 0
  56 +4 0 obj
  57 +<<
  58 + /Contents [
  59 + 15 0 R
  60 + 17 0 R
  61 + 19 0 R
  62 + ]
  63 + /MediaBox [
  64 + 0
  65 + 0
  66 + 306
  67 + 396
  68 + ]
  69 + /Parent 2 0 R
  70 + /Resources <<
  71 + /Font <<
  72 + /F1 21 0 R
  73 + >>
  74 + /ProcSet 22 0 R
  75 + /XObject <<
  76 + /Fx1 23 0 R
  77 + >>
  78 + >>
  79 + /Type /Page
  80 +>>
  81 +endobj
  82 +
  83 +%% Contents for page 1
  84 +%% Original object ID: 16 0
  85 +5 0 obj
  86 +<<
  87 + /Length 6 0 R
  88 +>>
  89 +stream
  90 +q
  91 +endstream
  92 +endobj
  93 +
  94 +6 0 obj
  95 +2
  96 +endobj
  97 +
  98 +%% Contents for page 1
  99 +%% Original object ID: 5 0
  100 +7 0 obj
  101 +<<
  102 + /Length 8 0 R
  103 +>>
  104 +stream
  105 +1 .5 0 RG
  106 +1 .5 0 rg
  107 +BT
  108 + /F1 24 Tf
  109 + 72 690 Td
  110 + (big) Tj
  111 +ET
  112 +5 w
  113 +0 0 612 792 re s
  114 +246 396 60 60 re f
  115 +endstream
  116 +endobj
  117 +
  118 +8 0 obj
  119 +101
  120 +endobj
  121 +
  122 +%% Contents for page 1
  123 +%% Original object ID: 17 0
  124 +9 0 obj
  125 +<<
  126 + /Length 10 0 R
  127 +>>
  128 +stream
  129 +
  130 +Q
  131 +q
  132 +1.00000 0.00000 0.00000 1.00000 153.00000 198.00000 cm
  133 +/Fx1 Do
  134 +Q
  135 +endstream
  136 +endobj
  137 +
  138 +10 0 obj
  139 +70
  140 +endobj
  141 +
  142 +%% Original object ID: 7 0
  143 +11 0 obj
  144 +<<
  145 + /BaseFont /Helvetica
  146 + /Encoding /WinAnsiEncoding
  147 + /Name /F1
  148 + /Subtype /Type1
  149 + /Type /Font
  150 +>>
  151 +endobj
  152 +
  153 +%% Original object ID: 8 0
  154 +12 0 obj
  155 +[
  156 + /PDF
  157 + /Text
  158 +]
  159 +endobj
  160 +
  161 +%% Original object ID: 13 0
  162 +13 0 obj
  163 +<<
  164 + /BBox [
  165 + 0
  166 + 0
  167 + 306
  168 + 396
  169 + ]
  170 + /Resources <<
  171 + /Font <<
  172 + /F1 25 0 R
  173 + >>
  174 + /ProcSet 26 0 R
  175 + >>
  176 + /Subtype /Form
  177 + /Type /XObject
  178 + /Length 14 0 R
  179 +>>
  180 +stream
  181 +.5 0 .5 RG
  182 +.5 0 .5 rg
  183 +BT
  184 + /F1 24 Tf
  185 + 36 345 Td
  186 + (small) Tj
  187 +ET
  188 +5 w
  189 +0 0 306 396 re s
  190 +153 198 30 30 re f
  191 +endstream
  192 +endobj
  193 +
  194 +14 0 obj
  195 +105
  196 +endobj
  197 +
  198 +%% Contents for page 2
  199 +%% Original object ID: 21 0
  200 +15 0 obj
  201 +<<
  202 + /Length 16 0 R
  203 +>>
  204 +stream
  205 +q
  206 +endstream
  207 +endobj
  208 +
  209 +16 0 obj
  210 +2
  211 +endobj
  212 +
  213 +%% Contents for page 2
  214 +%% Original object ID: 9 0
  215 +17 0 obj
  216 +<<
  217 + /Length 18 0 R
  218 +>>
  219 +stream
  220 +1 .5 0 RG
  221 +1 .5 0 rg
  222 +BT
  223 + /F1 24 Tf
  224 + 36 345 Td
  225 + (small) Tj
  226 +ET
  227 +5 w
  228 +0 0 306 396 re s
  229 +153 198 30 30 re f
  230 +endstream
  231 +endobj
  232 +
  233 +18 0 obj
  234 +103
  235 +endobj
  236 +
  237 +%% Contents for page 2
  238 +%% Original object ID: 22 0
  239 +19 0 obj
  240 +<<
  241 + /Length 20 0 R
  242 +>>
  243 +stream
  244 +
  245 +Q
  246 +q
  247 +0.50000 0.00000 0.00000 0.50000 0.00000 0.00000 cm
  248 +/Fx1 Do
  249 +Q
  250 +endstream
  251 +endobj
  252 +
  253 +20 0 obj
  254 +66
  255 +endobj
  256 +
  257 +%% Original object ID: 11 0
  258 +21 0 obj
  259 +<<
  260 + /BaseFont /Helvetica
  261 + /Encoding /WinAnsiEncoding
  262 + /Name /F1
  263 + /Subtype /Type1
  264 + /Type /Font
  265 +>>
  266 +endobj
  267 +
  268 +%% Original object ID: 12 0
  269 +22 0 obj
  270 +[
  271 + /PDF
  272 + /Text
  273 +]
  274 +endobj
  275 +
  276 +%% Original object ID: 18 0
  277 +23 0 obj
  278 +<<
  279 + /BBox [
  280 + 0
  281 + 0
  282 + 612
  283 + 792
  284 + ]
  285 + /Resources <<
  286 + /Font <<
  287 + /F1 27 0 R
  288 + >>
  289 + /ProcSet 28 0 R
  290 + >>
  291 + /Subtype /Form
  292 + /Type /XObject
  293 + /Length 24 0 R
  294 +>>
  295 +stream
  296 +.5 0 .5 RG
  297 +.5 0 .5 rg
  298 +BT
  299 + /F1 24 Tf
  300 + 72 690 Td
  301 + (big) Tj
  302 +ET
  303 +5 w
  304 +0 0 612 792 re s
  305 +246 396 60 60 re f
  306 +endstream
  307 +endobj
  308 +
  309 +24 0 obj
  310 +103
  311 +endobj
  312 +
  313 +%% Original object ID: 14 0
  314 +25 0 obj
  315 +<<
  316 + /BaseFont /Helvetica
  317 + /Encoding /WinAnsiEncoding
  318 + /Name /F1
  319 + /Subtype /Type1
  320 + /Type /Font
  321 +>>
  322 +endobj
  323 +
  324 +%% Original object ID: 15 0
  325 +26 0 obj
  326 +[
  327 + /PDF
  328 + /Text
  329 +]
  330 +endobj
  331 +
  332 +%% Original object ID: 19 0
  333 +27 0 obj
  334 +<<
  335 + /BaseFont /Helvetica
  336 + /Encoding /WinAnsiEncoding
  337 + /Name /F1
  338 + /Subtype /Type1
  339 + /Type /Font
  340 +>>
  341 +endobj
  342 +
  343 +%% Original object ID: 20 0
  344 +28 0 obj
  345 +[
  346 + /PDF
  347 + /Text
  348 +]
  349 +endobj
  350 +
  351 +xref
  352 +0 29
  353 +0000000000 65535 f
  354 +0000000052 00000 n
  355 +0000000133 00000 n
  356 +0000000252 00000 n
  357 +0000000554 00000 n
  358 +0000000873 00000 n
  359 +0000000930 00000 n
  360 +0000000998 00000 n
  361 +0000001154 00000 n
  362 +0000001225 00000 n
  363 +0000001351 00000 n
  364 +0000001398 00000 n
  365 +0000001544 00000 n
  366 +0000001608 00000 n
  367 +0000001924 00000 n
  368 +0000001996 00000 n
  369 +0000002055 00000 n
  370 +0000002124 00000 n
  371 +0000002284 00000 n
  372 +0000002356 00000 n
  373 +0000002479 00000 n
  374 +0000002527 00000 n
  375 +0000002674 00000 n
  376 +0000002738 00000 n
  377 +0000003052 00000 n
  378 +0000003101 00000 n
  379 +0000003248 00000 n
  380 +0000003312 00000 n
  381 +0000003459 00000 n
  382 +trailer <<
  383 + /Root 1 0 R
  384 + /Size 29
  385 + /ID [<4866f3ccc81fb28dc4a27f0f976ce937><31415926535897932384626433832795>]
  386 +>>
  387 +startxref
  388 +3495
  389 +%%EOF
... ...
qpdf/qtest/qpdf/fx-overlay-66.pdf 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 2
  17 + /Kids [
  18 + 3 0 R
  19 + 4 0 R
  20 + ]
  21 + /Type /Pages
  22 +>>
  23 +endobj
  24 +
  25 +%% Page 1
  26 +%% Original object ID: 3 0
  27 +3 0 obj
  28 +<<
  29 + /Contents [
  30 + 5 0 R
  31 + 7 0 R
  32 + 9 0 R
  33 + ]
  34 + /MediaBox [
  35 + 0
  36 + 0
  37 + 612
  38 + 792
  39 + ]
  40 + /Parent 2 0 R
  41 + /Resources <<
  42 + /Font <<
  43 + /F1 11 0 R
  44 + >>
  45 + /ProcSet 12 0 R
  46 + /XObject <<
  47 + /Fx1 13 0 R
  48 + >>
  49 + >>
  50 + /Type /Page
  51 +>>
  52 +endobj
  53 +
  54 +%% Page 2
  55 +%% Original object ID: 4 0
  56 +4 0 obj
  57 +<<
  58 + /Contents [
  59 + 15 0 R
  60 + 17 0 R
  61 + 19 0 R
  62 + ]
  63 + /MediaBox [
  64 + 0
  65 + 0
  66 + 306
  67 + 396
  68 + ]
  69 + /Parent 2 0 R
  70 + /Resources <<
  71 + /Font <<
  72 + /F1 21 0 R
  73 + >>
  74 + /ProcSet 22 0 R
  75 + /XObject <<
  76 + /Fx1 23 0 R
  77 + >>
  78 + >>
  79 + /Type /Page
  80 +>>
  81 +endobj
  82 +
  83 +%% Contents for page 1
  84 +%% Original object ID: 16 0
  85 +5 0 obj
  86 +<<
  87 + /Length 6 0 R
  88 +>>
  89 +stream
  90 +q
  91 +endstream
  92 +endobj
  93 +
  94 +6 0 obj
  95 +2
  96 +endobj
  97 +
  98 +%% Contents for page 1
  99 +%% Original object ID: 5 0
  100 +7 0 obj
  101 +<<
  102 + /Length 8 0 R
  103 +>>
  104 +stream
  105 +1 .5 0 RG
  106 +1 .5 0 rg
  107 +BT
  108 + /F1 24 Tf
  109 + 72 690 Td
  110 + (big) Tj
  111 +ET
  112 +5 w
  113 +0 0 612 792 re s
  114 +246 396 60 60 re f
  115 +endstream
  116 +endobj
  117 +
  118 +8 0 obj
  119 +101
  120 +endobj
  121 +
  122 +%% Contents for page 1
  123 +%% Original object ID: 17 0
  124 +9 0 obj
  125 +<<
  126 + /Length 10 0 R
  127 +>>
  128 +stream
  129 +
  130 +Q
  131 +q
  132 +2.00000 0.00000 0.00000 2.00000 0.00000 0.00000 cm
  133 +/Fx1 Do
  134 +Q
  135 +endstream
  136 +endobj
  137 +
  138 +10 0 obj
  139 +66
  140 +endobj
  141 +
  142 +%% Original object ID: 7 0
  143 +11 0 obj
  144 +<<
  145 + /BaseFont /Helvetica
  146 + /Encoding /WinAnsiEncoding
  147 + /Name /F1
  148 + /Subtype /Type1
  149 + /Type /Font
  150 +>>
  151 +endobj
  152 +
  153 +%% Original object ID: 8 0
  154 +12 0 obj
  155 +[
  156 + /PDF
  157 + /Text
  158 +]
  159 +endobj
  160 +
  161 +%% Original object ID: 13 0
  162 +13 0 obj
  163 +<<
  164 + /BBox [
  165 + 0
  166 + 0
  167 + 306
  168 + 396
  169 + ]
  170 + /Resources <<
  171 + /Font <<
  172 + /F1 25 0 R
  173 + >>
  174 + /ProcSet 26 0 R
  175 + >>
  176 + /Subtype /Form
  177 + /Type /XObject
  178 + /Length 14 0 R
  179 +>>
  180 +stream
  181 +.5 0 .5 RG
  182 +.5 0 .5 rg
  183 +BT
  184 + /F1 24 Tf
  185 + 36 345 Td
  186 + (small) Tj
  187 +ET
  188 +5 w
  189 +0 0 306 396 re s
  190 +153 198 30 30 re f
  191 +endstream
  192 +endobj
  193 +
  194 +14 0 obj
  195 +105
  196 +endobj
  197 +
  198 +%% Contents for page 2
  199 +%% Original object ID: 21 0
  200 +15 0 obj
  201 +<<
  202 + /Length 16 0 R
  203 +>>
  204 +stream
  205 +q
  206 +endstream
  207 +endobj
  208 +
  209 +16 0 obj
  210 +2
  211 +endobj
  212 +
  213 +%% Contents for page 2
  214 +%% Original object ID: 9 0
  215 +17 0 obj
  216 +<<
  217 + /Length 18 0 R
  218 +>>
  219 +stream
  220 +1 .5 0 RG
  221 +1 .5 0 rg
  222 +BT
  223 + /F1 24 Tf
  224 + 36 345 Td
  225 + (small) Tj
  226 +ET
  227 +5 w
  228 +0 0 306 396 re s
  229 +153 198 30 30 re f
  230 +endstream
  231 +endobj
  232 +
  233 +18 0 obj
  234 +103
  235 +endobj
  236 +
  237 +%% Contents for page 2
  238 +%% Original object ID: 22 0
  239 +19 0 obj
  240 +<<
  241 + /Length 20 0 R
  242 +>>
  243 +stream
  244 +
  245 +Q
  246 +q
  247 +1.00000 0.00000 0.00000 1.00000 -153.00000 -198.00000 cm
  248 +/Fx1 Do
  249 +Q
  250 +endstream
  251 +endobj
  252 +
  253 +20 0 obj
  254 +72
  255 +endobj
  256 +
  257 +%% Original object ID: 11 0
  258 +21 0 obj
  259 +<<
  260 + /BaseFont /Helvetica
  261 + /Encoding /WinAnsiEncoding
  262 + /Name /F1
  263 + /Subtype /Type1
  264 + /Type /Font
  265 +>>
  266 +endobj
  267 +
  268 +%% Original object ID: 12 0
  269 +22 0 obj
  270 +[
  271 + /PDF
  272 + /Text
  273 +]
  274 +endobj
  275 +
  276 +%% Original object ID: 18 0
  277 +23 0 obj
  278 +<<
  279 + /BBox [
  280 + 0
  281 + 0
  282 + 612
  283 + 792
  284 + ]
  285 + /Resources <<
  286 + /Font <<
  287 + /F1 27 0 R
  288 + >>
  289 + /ProcSet 28 0 R
  290 + >>
  291 + /Subtype /Form
  292 + /Type /XObject
  293 + /Length 24 0 R
  294 +>>
  295 +stream
  296 +.5 0 .5 RG
  297 +.5 0 .5 rg
  298 +BT
  299 + /F1 24 Tf
  300 + 72 690 Td
  301 + (big) Tj
  302 +ET
  303 +5 w
  304 +0 0 612 792 re s
  305 +246 396 60 60 re f
  306 +endstream
  307 +endobj
  308 +
  309 +24 0 obj
  310 +103
  311 +endobj
  312 +
  313 +%% Original object ID: 14 0
  314 +25 0 obj
  315 +<<
  316 + /BaseFont /Helvetica
  317 + /Encoding /WinAnsiEncoding
  318 + /Name /F1
  319 + /Subtype /Type1
  320 + /Type /Font
  321 +>>
  322 +endobj
  323 +
  324 +%% Original object ID: 15 0
  325 +26 0 obj
  326 +[
  327 + /PDF
  328 + /Text
  329 +]
  330 +endobj
  331 +
  332 +%% Original object ID: 19 0
  333 +27 0 obj
  334 +<<
  335 + /BaseFont /Helvetica
  336 + /Encoding /WinAnsiEncoding
  337 + /Name /F1
  338 + /Subtype /Type1
  339 + /Type /Font
  340 +>>
  341 +endobj
  342 +
  343 +%% Original object ID: 20 0
  344 +28 0 obj
  345 +[
  346 + /PDF
  347 + /Text
  348 +]
  349 +endobj
  350 +
  351 +xref
  352 +0 29
  353 +0000000000 65535 f
  354 +0000000052 00000 n
  355 +0000000133 00000 n
  356 +0000000252 00000 n
  357 +0000000554 00000 n
  358 +0000000873 00000 n
  359 +0000000930 00000 n
  360 +0000000998 00000 n
  361 +0000001154 00000 n
  362 +0000001225 00000 n
  363 +0000001347 00000 n
  364 +0000001394 00000 n
  365 +0000001540 00000 n
  366 +0000001604 00000 n
  367 +0000001920 00000 n
  368 +0000001992 00000 n
  369 +0000002051 00000 n
  370 +0000002120 00000 n
  371 +0000002280 00000 n
  372 +0000002352 00000 n
  373 +0000002481 00000 n
  374 +0000002529 00000 n
  375 +0000002676 00000 n
  376 +0000002740 00000 n
  377 +0000003054 00000 n
  378 +0000003103 00000 n
  379 +0000003250 00000 n
  380 +0000003314 00000 n
  381 +0000003461 00000 n
  382 +trailer <<
  383 + /Root 1 0 R
  384 + /Size 29
  385 + /ID [<4866f3ccc81fb28dc4a27f0f976ce937><31415926535897932384626433832795>]
  386 +>>
  387 +startxref
  388 +3497
  389 +%%EOF
... ...
qpdf/qtest/qpdf/fx-overlay-67.pdf 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 2
  17 + /Kids [
  18 + 3 0 R
  19 + 4 0 R
  20 + ]
  21 + /Type /Pages
  22 +>>
  23 +endobj
  24 +
  25 +%% Page 1
  26 +%% Original object ID: 3 0
  27 +3 0 obj
  28 +<<
  29 + /Contents [
  30 + 5 0 R
  31 + 7 0 R
  32 + 9 0 R
  33 + ]
  34 + /MediaBox [
  35 + 0
  36 + 0
  37 + 612
  38 + 792
  39 + ]
  40 + /Parent 2 0 R
  41 + /Resources <<
  42 + /Font <<
  43 + /F1 11 0 R
  44 + >>
  45 + /ProcSet 12 0 R
  46 + /XObject <<
  47 + /Fx1 13 0 R
  48 + >>
  49 + >>
  50 + /Type /Page
  51 +>>
  52 +endobj
  53 +
  54 +%% Page 2
  55 +%% Original object ID: 4 0
  56 +4 0 obj
  57 +<<
  58 + /Contents [
  59 + 15 0 R
  60 + 17 0 R
  61 + 19 0 R
  62 + ]
  63 + /MediaBox [
  64 + 0
  65 + 0
  66 + 306
  67 + 396
  68 + ]
  69 + /Parent 2 0 R
  70 + /Resources <<
  71 + /Font <<
  72 + /F1 21 0 R
  73 + >>
  74 + /ProcSet 22 0 R
  75 + /XObject <<
  76 + /Fx1 23 0 R
  77 + >>
  78 + >>
  79 + /Type /Page
  80 +>>
  81 +endobj
  82 +
  83 +%% Contents for page 1
  84 +%% Original object ID: 16 0
  85 +5 0 obj
  86 +<<
  87 + /Length 6 0 R
  88 +>>
  89 +stream
  90 +q
  91 +endstream
  92 +endobj
  93 +
  94 +6 0 obj
  95 +2
  96 +endobj
  97 +
  98 +%% Contents for page 1
  99 +%% Original object ID: 5 0
  100 +7 0 obj
  101 +<<
  102 + /Length 8 0 R
  103 +>>
  104 +stream
  105 +1 .5 0 RG
  106 +1 .5 0 rg
  107 +BT
  108 + /F1 24 Tf
  109 + 72 690 Td
  110 + (big) Tj
  111 +ET
  112 +5 w
  113 +0 0 612 792 re s
  114 +246 396 60 60 re f
  115 +endstream
  116 +endobj
  117 +
  118 +8 0 obj
  119 +101
  120 +endobj
  121 +
  122 +%% Contents for page 1
  123 +%% Original object ID: 17 0
  124 +9 0 obj
  125 +<<
  126 + /Length 10 0 R
  127 +>>
  128 +stream
  129 +
  130 +Q
  131 +q
  132 +2.00000 0.00000 0.00000 2.00000 0.00000 0.00000 cm
  133 +/Fx1 Do
  134 +Q
  135 +endstream
  136 +endobj
  137 +
  138 +10 0 obj
  139 +66
  140 +endobj
  141 +
  142 +%% Original object ID: 7 0
  143 +11 0 obj
  144 +<<
  145 + /BaseFont /Helvetica
  146 + /Encoding /WinAnsiEncoding
  147 + /Name /F1
  148 + /Subtype /Type1
  149 + /Type /Font
  150 +>>
  151 +endobj
  152 +
  153 +%% Original object ID: 8 0
  154 +12 0 obj
  155 +[
  156 + /PDF
  157 + /Text
  158 +]
  159 +endobj
  160 +
  161 +%% Original object ID: 13 0
  162 +13 0 obj
  163 +<<
  164 + /BBox [
  165 + 0
  166 + 0
  167 + 306
  168 + 396
  169 + ]
  170 + /Resources <<
  171 + /Font <<
  172 + /F1 25 0 R
  173 + >>
  174 + /ProcSet 26 0 R
  175 + >>
  176 + /Subtype /Form
  177 + /Type /XObject
  178 + /Length 14 0 R
  179 +>>
  180 +stream
  181 +.5 0 .5 RG
  182 +.5 0 .5 rg
  183 +BT
  184 + /F1 24 Tf
  185 + 36 345 Td
  186 + (small) Tj
  187 +ET
  188 +5 w
  189 +0 0 306 396 re s
  190 +153 198 30 30 re f
  191 +endstream
  192 +endobj
  193 +
  194 +14 0 obj
  195 +105
  196 +endobj
  197 +
  198 +%% Contents for page 2
  199 +%% Original object ID: 21 0
  200 +15 0 obj
  201 +<<
  202 + /Length 16 0 R
  203 +>>
  204 +stream
  205 +q
  206 +endstream
  207 +endobj
  208 +
  209 +16 0 obj
  210 +2
  211 +endobj
  212 +
  213 +%% Contents for page 2
  214 +%% Original object ID: 9 0
  215 +17 0 obj
  216 +<<
  217 + /Length 18 0 R
  218 +>>
  219 +stream
  220 +1 .5 0 RG
  221 +1 .5 0 rg
  222 +BT
  223 + /F1 24 Tf
  224 + 36 345 Td
  225 + (small) Tj
  226 +ET
  227 +5 w
  228 +0 0 306 396 re s
  229 +153 198 30 30 re f
  230 +endstream
  231 +endobj
  232 +
  233 +18 0 obj
  234 +103
  235 +endobj
  236 +
  237 +%% Contents for page 2
  238 +%% Original object ID: 22 0
  239 +19 0 obj
  240 +<<
  241 + /Length 20 0 R
  242 +>>
  243 +stream
  244 +
  245 +Q
  246 +q
  247 +0.50000 0.00000 0.00000 0.50000 0.00000 0.00000 cm
  248 +/Fx1 Do
  249 +Q
  250 +endstream
  251 +endobj
  252 +
  253 +20 0 obj
  254 +66
  255 +endobj
  256 +
  257 +%% Original object ID: 11 0
  258 +21 0 obj
  259 +<<
  260 + /BaseFont /Helvetica
  261 + /Encoding /WinAnsiEncoding
  262 + /Name /F1
  263 + /Subtype /Type1
  264 + /Type /Font
  265 +>>
  266 +endobj
  267 +
  268 +%% Original object ID: 12 0
  269 +22 0 obj
  270 +[
  271 + /PDF
  272 + /Text
  273 +]
  274 +endobj
  275 +
  276 +%% Original object ID: 18 0
  277 +23 0 obj
  278 +<<
  279 + /BBox [
  280 + 0
  281 + 0
  282 + 612
  283 + 792
  284 + ]
  285 + /Resources <<
  286 + /Font <<
  287 + /F1 27 0 R
  288 + >>
  289 + /ProcSet 28 0 R
  290 + >>
  291 + /Subtype /Form
  292 + /Type /XObject
  293 + /Length 24 0 R
  294 +>>
  295 +stream
  296 +.5 0 .5 RG
  297 +.5 0 .5 rg
  298 +BT
  299 + /F1 24 Tf
  300 + 72 690 Td
  301 + (big) Tj
  302 +ET
  303 +5 w
  304 +0 0 612 792 re s
  305 +246 396 60 60 re f
  306 +endstream
  307 +endobj
  308 +
  309 +24 0 obj
  310 +103
  311 +endobj
  312 +
  313 +%% Original object ID: 14 0
  314 +25 0 obj
  315 +<<
  316 + /BaseFont /Helvetica
  317 + /Encoding /WinAnsiEncoding
  318 + /Name /F1
  319 + /Subtype /Type1
  320 + /Type /Font
  321 +>>
  322 +endobj
  323 +
  324 +%% Original object ID: 15 0
  325 +26 0 obj
  326 +[
  327 + /PDF
  328 + /Text
  329 +]
  330 +endobj
  331 +
  332 +%% Original object ID: 19 0
  333 +27 0 obj
  334 +<<
  335 + /BaseFont /Helvetica
  336 + /Encoding /WinAnsiEncoding
  337 + /Name /F1
  338 + /Subtype /Type1
  339 + /Type /Font
  340 +>>
  341 +endobj
  342 +
  343 +%% Original object ID: 20 0
  344 +28 0 obj
  345 +[
  346 + /PDF
  347 + /Text
  348 +]
  349 +endobj
  350 +
  351 +xref
  352 +0 29
  353 +0000000000 65535 f
  354 +0000000052 00000 n
  355 +0000000133 00000 n
  356 +0000000252 00000 n
  357 +0000000554 00000 n
  358 +0000000873 00000 n
  359 +0000000930 00000 n
  360 +0000000998 00000 n
  361 +0000001154 00000 n
  362 +0000001225 00000 n
  363 +0000001347 00000 n
  364 +0000001394 00000 n
  365 +0000001540 00000 n
  366 +0000001604 00000 n
  367 +0000001920 00000 n
  368 +0000001992 00000 n
  369 +0000002051 00000 n
  370 +0000002120 00000 n
  371 +0000002280 00000 n
  372 +0000002352 00000 n
  373 +0000002475 00000 n
  374 +0000002523 00000 n
  375 +0000002670 00000 n
  376 +0000002734 00000 n
  377 +0000003048 00000 n
  378 +0000003097 00000 n
  379 +0000003244 00000 n
  380 +0000003308 00000 n
  381 +0000003455 00000 n
  382 +trailer <<
  383 + /Root 1 0 R
  384 + /Size 29
  385 + /ID [<4866f3ccc81fb28dc4a27f0f976ce937><31415926535897932384626433832795>]
  386 +>>
  387 +startxref
  388 +3491
  389 +%%EOF
... ...
qpdf/qtest/qpdf/fxo-bigsmall.pdf 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 2
  17 + /Kids [
  18 + 3 0 R
  19 + 4 0 R
  20 + ]
  21 + /Type /Pages
  22 +>>
  23 +endobj
  24 +
  25 +%% Page 1
  26 +%% Original object ID: 3 0
  27 +3 0 obj
  28 +<<
  29 + /Contents 5 0 R
  30 + /MediaBox [
  31 + 0
  32 + 0
  33 + 612
  34 + 792
  35 + ]
  36 + /Parent 2 0 R
  37 + /Resources <<
  38 + /Font <<
  39 + /F1 7 0 R
  40 + >>
  41 + /ProcSet 8 0 R
  42 + >>
  43 + /Type /Page
  44 +>>
  45 +endobj
  46 +
  47 +%% Page 2
  48 +%% Original object ID: 8 0
  49 +4 0 obj
  50 +<<
  51 + /Contents 9 0 R
  52 + /MediaBox [
  53 + 0
  54 + 0
  55 + 306
  56 + 396
  57 + ]
  58 + /Parent 2 0 R
  59 + /Resources <<
  60 + /Font <<
  61 + /F1 11 0 R
  62 + >>
  63 + /ProcSet 12 0 R
  64 + >>
  65 + /Type /Page
  66 +>>
  67 +endobj
  68 +
  69 +%% Contents for page 1
  70 +%% Original object ID: 4 0
  71 +5 0 obj
  72 +<<
  73 + /Length 6 0 R
  74 +>>
  75 +stream
  76 +1 .5 0 RG
  77 +1 .5 0 rg
  78 +BT
  79 + /F1 24 Tf
  80 + 72 690 Td
  81 + (big) Tj
  82 +ET
  83 +5 w
  84 +0 0 612 792 re s
  85 +246 396 60 60 re f
  86 +endstream
  87 +endobj
  88 +
  89 +6 0 obj
  90 +101
  91 +endobj
  92 +
  93 +%% Original object ID: 6 0
  94 +7 0 obj
  95 +<<
  96 + /BaseFont /Helvetica
  97 + /Encoding /WinAnsiEncoding
  98 + /Name /F1
  99 + /Subtype /Type1
  100 + /Type /Font
  101 +>>
  102 +endobj
  103 +
  104 +%% Original object ID: 7 0
  105 +8 0 obj
  106 +[
  107 + /PDF
  108 + /Text
  109 +]
  110 +endobj
  111 +
  112 +%% Contents for page 2
  113 +%% Original object ID: 9 0
  114 +9 0 obj
  115 +<<
  116 + /Length 10 0 R
  117 +>>
  118 +stream
  119 +1 .5 0 RG
  120 +1 .5 0 rg
  121 +BT
  122 + /F1 24 Tf
  123 + 36 345 Td
  124 + (small) Tj
  125 +ET
  126 +5 w
  127 +0 0 306 396 re s
  128 +153 198 30 30 re f
  129 +endstream
  130 +endobj
  131 +
  132 +10 0 obj
  133 +103
  134 +endobj
  135 +
  136 +%% Original object ID: 11 0
  137 +11 0 obj
  138 +<<
  139 + /BaseFont /Helvetica
  140 + /Encoding /WinAnsiEncoding
  141 + /Name /F1
  142 + /Subtype /Type1
  143 + /Type /Font
  144 +>>
  145 +endobj
  146 +
  147 +%% Original object ID: 12 0
  148 +12 0 obj
  149 +[
  150 + /PDF
  151 + /Text
  152 +]
  153 +endobj
  154 +
  155 +xref
  156 +0 13
  157 +0000000000 65535 f
  158 +0000000052 00000 n
  159 +0000000133 00000 n
  160 +0000000252 00000 n
  161 +0000000481 00000 n
  162 +0000000725 00000 n
  163 +0000000881 00000 n
  164 +0000000928 00000 n
  165 +0000001073 00000 n
  166 +0000001158 00000 n
  167 +0000001317 00000 n
  168 +0000001366 00000 n
  169 +0000001513 00000 n
  170 +trailer <<
  171 + /Root 1 0 R
  172 + /Size 13
  173 + /ID [<4866f3ccc81fb28dc4a27f0f976ce937><5b260ad1f0f4ccd7895374e61eff0d55>]
  174 +>>
  175 +startxref
  176 +1549
  177 +%%EOF
... ...
qpdf/qtest/qpdf/fxo-smallbig.pdf 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 2
  17 + /Kids [
  18 + 3 0 R
  19 + 4 0 R
  20 + ]
  21 + /Type /Pages
  22 +>>
  23 +endobj
  24 +
  25 +%% Page 1
  26 +%% Original object ID: 3 0
  27 +3 0 obj
  28 +<<
  29 + /Contents 5 0 R
  30 + /MediaBox [
  31 + 0
  32 + 0
  33 + 306
  34 + 396
  35 + ]
  36 + /Parent 2 0 R
  37 + /Resources <<
  38 + /Font <<
  39 + /F1 7 0 R
  40 + >>
  41 + /ProcSet 8 0 R
  42 + >>
  43 + /Type /Page
  44 +>>
  45 +endobj
  46 +
  47 +%% Page 2
  48 +%% Original object ID: 8 0
  49 +4 0 obj
  50 +<<
  51 + /Contents 9 0 R
  52 + /MediaBox [
  53 + 0
  54 + 0
  55 + 612
  56 + 792
  57 + ]
  58 + /Parent 2 0 R
  59 + /Resources <<
  60 + /Font <<
  61 + /F1 11 0 R
  62 + >>
  63 + /ProcSet 12 0 R
  64 + >>
  65 + /Type /Page
  66 +>>
  67 +endobj
  68 +
  69 +%% Contents for page 1
  70 +%% Original object ID: 4 0
  71 +5 0 obj
  72 +<<
  73 + /Length 6 0 R
  74 +>>
  75 +stream
  76 +.5 0 .5 RG
  77 +.5 0 .5 rg
  78 +BT
  79 + /F1 24 Tf
  80 + 36 345 Td
  81 + (small) Tj
  82 +ET
  83 +5 w
  84 +0 0 306 396 re s
  85 +153 198 30 30 re f
  86 +endstream
  87 +endobj
  88 +
  89 +6 0 obj
  90 +105
  91 +endobj
  92 +
  93 +%% Original object ID: 6 0
  94 +7 0 obj
  95 +<<
  96 + /BaseFont /Helvetica
  97 + /Encoding /WinAnsiEncoding
  98 + /Name /F1
  99 + /Subtype /Type1
  100 + /Type /Font
  101 +>>
  102 +endobj
  103 +
  104 +%% Original object ID: 7 0
  105 +8 0 obj
  106 +[
  107 + /PDF
  108 + /Text
  109 +]
  110 +endobj
  111 +
  112 +%% Contents for page 2
  113 +%% Original object ID: 9 0
  114 +9 0 obj
  115 +<<
  116 + /Length 10 0 R
  117 +>>
  118 +stream
  119 +.5 0 .5 RG
  120 +.5 0 .5 rg
  121 +BT
  122 + /F1 24 Tf
  123 + 72 690 Td
  124 + (big) Tj
  125 +ET
  126 +5 w
  127 +0 0 612 792 re s
  128 +246 396 60 60 re f
  129 +endstream
  130 +endobj
  131 +
  132 +10 0 obj
  133 +103
  134 +endobj
  135 +
  136 +%% Original object ID: 11 0
  137 +11 0 obj
  138 +<<
  139 + /BaseFont /Helvetica
  140 + /Encoding /WinAnsiEncoding
  141 + /Name /F1
  142 + /Subtype /Type1
  143 + /Type /Font
  144 +>>
  145 +endobj
  146 +
  147 +%% Original object ID: 12 0
  148 +12 0 obj
  149 +[
  150 + /PDF
  151 + /Text
  152 +]
  153 +endobj
  154 +
  155 +xref
  156 +0 13
  157 +0000000000 65535 f
  158 +0000000052 00000 n
  159 +0000000133 00000 n
  160 +0000000252 00000 n
  161 +0000000481 00000 n
  162 +0000000725 00000 n
  163 +0000000885 00000 n
  164 +0000000932 00000 n
  165 +0000001077 00000 n
  166 +0000001162 00000 n
  167 +0000001321 00000 n
  168 +0000001370 00000 n
  169 +0000001517 00000 n
  170 +trailer <<
  171 + /Root 1 0 R
  172 + /Size 13
  173 + /ID [<4866f3ccc81fb28dc4a27f0f976ce937><7ac42e786a05e6c1a5adfc1c1f33e15c>]
  174 +>>
  175 +startxref
  176 +1553
  177 +%%EOF
... ...
qpdf/test_driver.cc
... ... @@ -2116,6 +2116,57 @@ void runtest(int n, char const* filename1, char const* arg2)
2116 2116 w.setOutputFilename("a.pdf");
2117 2117 w.write();
2118 2118 }
  2119 + else if ((n >= 64) && (n <= 67))
  2120 + {
  2121 + // Placing form XObjects: expand, shrink
  2122 + assert(arg2);
  2123 + QPDF pdf2;
  2124 + pdf2.processFile(arg2);
  2125 +
  2126 + // Overlay file2 on file1.
  2127 + // 64: allow neither shrink nor shrink
  2128 + // 65: allow shrink but not expand
  2129 + // 66: allow expand but not shrink
  2130 + // 67: allow both shrink and expand
  2131 + bool allow_shrink = ((n == 65) || (n == 67));
  2132 + bool allow_expand = ((n == 66) || (n == 67));
  2133 + std::vector<QPDFPageObjectHelper> pages1 =
  2134 + QPDFPageDocumentHelper(pdf).getAllPages();
  2135 + std::vector<QPDFPageObjectHelper> pages2 =
  2136 + QPDFPageDocumentHelper(pdf2).getAllPages();
  2137 + size_t npages = (pages1.size() < pages2.size()
  2138 + ? pages1.size() : pages2.size());
  2139 + for (size_t i = 0; i < npages; ++i)
  2140 + {
  2141 + QPDFPageObjectHelper& ph1 = pages1.at(i);
  2142 + QPDFPageObjectHelper& ph2 = pages2.at(i);
  2143 + QPDFObjectHandle fo = pdf.copyForeignObject(
  2144 + ph2.getFormXObjectForPage());
  2145 + int min_suffix = 1;
  2146 + QPDFObjectHandle resources = ph1.getAttribute("/Resources", true);
  2147 + std::string name = resources.getUniqueResourceName(
  2148 + "/Fx", min_suffix);
  2149 + std::string content =
  2150 + ph1.placeFormXObject(
  2151 + fo, name, ph1.getTrimBox().getArrayAsRectangle(),
  2152 + false, allow_shrink, allow_expand);
  2153 + if (! content.empty())
  2154 + {
  2155 + resources.mergeResources(
  2156 + QPDFObjectHandle::parse("<< /XObject << >> >>"));
  2157 + resources.getKey("/XObject").replaceKey(name, fo);
  2158 + ph1.addPageContents(
  2159 + QPDFObjectHandle::newStream(&pdf, "q\n"), true);
  2160 + ph1.addPageContents(
  2161 + QPDFObjectHandle::newStream(&pdf, "\nQ\n" + content),
  2162 + false);
  2163 + }
  2164 + }
  2165 + QPDFWriter w(pdf, "a.pdf");
  2166 + w.setQDFMode(true);
  2167 + w.setStaticID(true);
  2168 + w.write();
  2169 + }
2119 2170 else
2120 2171 {
2121 2172 throw std::runtime_error(std::string("invalid test ") +
... ...