-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChangeLog
4013 lines (2950 loc) · 157 KB
/
ChangeLog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
2022-02-09 Jay Berkenbilt <[email protected]>
* 10.6.0: release
* Fix one more PDF doc encoding omission: 0xAD is also undefined.
Fixes #637.
2022-02-08 Jay Berkenbilt <[email protected]>
* Bug fix: when splitting pages with --split-pages or selecting
pages with --pages, set the output PDF version to the maximum of
all the input PDF versions. This is a fix to QPDFJob. If you are
creating output PDF files yourself from multiple inputs, you will
need to code the same thing. The new PDFVersion object, its
updateIfGreater() method, and the new QPDF and QPDFWriter methods
described below make this very easy to do. Fixes #610.
* Add new class PDFVersion for more convenient comparison of PDF
version numbers from the %!PDF header.
* Add QPDF::getVersionAsPDFVersion() to return the PDF version and
extension together as a PDFVersion object instead of a string.
* Add a QPDFWriter::setMinimumPDFVersion() that takes a PDFVersion
object.
2022-02-06 Jay Berkenbilt <[email protected]>
* Pl_Buffer and QPDFWriter: add getBufferSharedPointer(), which
turns a PointerHolder<Buffer> but will return a
std::shared_ptr<Buffer> in qpdf 11.
* From m-holger: add getKeyIfDict(), which calls getKey for
dictionaries and returns null if called on null. This is for
easier access to optional, lower-level dictionaries.
2022-02-05 Jay Berkenbilt <[email protected]>
* Add several new accessors to QPDFObjectHandle: the bool
getValueAsX(X&) accessors allow an alternative way to retrieve
values from QPDFObjectHandle objects and can result in more
concise code in many situations. Thanks to m-holger for the
contribution.
* Add qpdf_oh_new_binary_unicode_string and
qpdf_oh_get_binary_utf8_value to the C API. This makes it possible
to handle UTF-8-encoded strings with embedded NUL characters. Thanks
to m-holger for the contribution.
* Add a global user-defined string literal "_qpdf" as a shorthand
for QPDFObjectHandle::parse, allowing you to create
QPDFObjectHandle objects with
QPDFObjectHandle oh = "<</Some (PDF)>>"_qpdf;
* Expose QPDF::emptyPDF to the C API as qpdf_empty_pdf()
* Add comments letting people know that the version string
returned by QPDF::QPDFVersion and qpdf_get_qpdf_version is static.
* Add QUtil::make_unique_cstr to return a std::unique_ptr<char[]>
as an alternative to QUtil::copy_string and
QUtil::make_shared_cstr.
2022-02-04 Jay Berkenbilt <[email protected]>
* New preprocessor symbols QPDF_MAJOR_VERSION, QPDF_MINOR_VERSION,
QPDF_PATCH_VERSION as numbers and QPDF_VERSION as a string. These
can be used for feature testing in code. These are in qpdf/DLL.h,
which is included by every header that adds to the public API.
Since these constants are introduced in version 10.6, it's
important for them to be in a header that everyone already
includes so you don't have to try to include a header that won't
be there.
* PointerHolder: add a get() method and a use_count() method for
compatibility with std::shared_ptr. In qpdf 11, qpdf's APIs will
switch to using std::shared_ptr instead of PointerHolder, though
there will be a PointerHolder class with a backward-compatible
API. To ease the transition, we are adding get() now with the same
semantics as std::shared_ptr's get. Note that there is a
difference in behavior: const PointerHolder has always behaved
incorrectly. const PointerHolder objects only returned const
pointers. This is wrong. If you want a const pointer, use
PointerHolder<T const>. A const PointerHolder just shouldn't allow
its pointer to be reassigned. The new get() method behaves
correctly in that calling get() on a const PointerHolder to a
non-const pointer returns a non-const pointer. This is the way
regular pointers behave.
2022-02-01 Jay Berkenbilt <[email protected]>
* Major refactor: all functionality from the qpdf CLI is now
available for library users using the QPDFJob class. See comments
in include/qpdf/QPDFJob.hh and a new chapter about QPDFJob in the
manual. QPDFJob provides fluent interfaces for setting options
that exactly map to command-line arguments. There are also methods
for initializing QPDFJob from an argv array and from a JSON
object.
* A light C API around basic QPDFJob functionality is in
include/qpdf/qpdfjob-c.h.p
* Add new functions version of QUtil::call_main_from_wmain that
takes a constant argv array.
2022-01-31 Jay Berkenbilt <[email protected]>
* Have --json-help just output the JSON object, leaving a
description to --help and the manual.
* The --json flag now takes a version number as an optional
parameter. The default will remain version 1 for compatibility
until the release of qpdf 11, after which it will become "latest".
At this time, there's only version 1, but a version 2 may appear
in a future qpdf.
2022-01-28 Jay Berkenbilt <[email protected]>
* Add QPDFUsage exception, which is thrown by QPDFJob to indicate
command-line usage or job configuration errors.
2022-01-22 Jay Berkenbilt <[email protected]>
* Add QUtil::make_shared_cstr to return a std::shared_ptr<char>
instead of a char* like QUtil::copy_string
* JSON: for (qpdf-specific, not official) "schema" checking, add
the ability to treat missing fields as optional. Also ensure that
values in the schema are dictionary, array, or string.
* Add convenience methods isNameAndEquals and isDictionaryOfType
to QPDFObjectHandle with corresponding functions added to the C
API. Thanks to m-holger for the contribution.
2022-01-17 Jay Berkenbilt <[email protected]>
* Add JSON::parse. Now qpdf's JSON class implements a
general-purpose JSON parser and serializer, but there are better
options for general use. This is really designed for qpdf's
internal use and is set up to be compatible with qpdf's existing
API and to hook into a planned JSON-based API to the QPDFJob
class.
* Add isDictionary and isArray to JSON
2022-01-11 Jay Berkenbilt <[email protected]>
* Major overhaul of documentation and help for the qpdf
command-line tool. qpdf --help is now broken into topics rather
than being one great wall of text, and the command-line arguments
are indexed in the manual. The entire text of the "Running qpdf"
chapter has been reviewed thoroughly. Many thanks once again to
M. Holger for a detailed review and editorial assistance with the
manual.
* Bug fix: add missing characters from PDF doc encoding.
Fixes #606.
2021-12-29 Jay Berkenbilt <[email protected]>
* Add method QUtil::file_can_be_opened
2021-12-21 Jay Berkenbilt <[email protected]>
* 10.5.0: release
* Add documentation link to top-level README
* Discontinue inclusion of the pre-built documentation in the
source distribution. Consult the packaging documentation in the
manual for details. The file README-doc.txt is installed in the
doc directory by default and contains information that users will
need to know to find the documentation.
2021-12-19 Jay Berkenbilt <[email protected]>
* C API: clarify documentation around string lengths. Add two new
methods: qpdf_oh_get_binary_string_value and
qpdf_oh_new_binary_string to make the need to handle the length
and data separate in more explicit in cases in which the string
data may contain embedded null characters.
2021-12-17 Jay Berkenbilt <[email protected]>
* C API: simplify error handling for uncaught errors (never in a
released version) and clarify documentation in qpdf-c.h around
error handling. See qpdf-c.h for details, including how to check
for errors and the new function qpdf_silence_errors.
* C API: expose getTypeCode and getTypeName from QPDFObjectHandle.
Fixes #597.
* C API: add functions for working with stream data. Search for
"STREAM FUNCTIONS" in qpdf-c.h. Fixes #596.
* QPDFObjectHandle object types have been moved from
QPDFObject::object_type_e to qpdf_object_type_e (defined in
Constants.h). Old values are available for backward compatibility.
* Add Pl_Buffer::getMallocBuffer() to initialize a buffer with
malloc in support of the C API
2021-12-16 Jay Berkenbilt <[email protected]>
* Add several functions to the C API for working with pages. C
wrappers around several of the "Legacy" page operations from
QPDFObjectHandle.hh have been added. See "PAGE FUNCTIONS" in
qpdf-c.h for details. Fixes #594.
2021-12-12 Jay Berkenbilt <[email protected]>
* Convert documentation from docbook to reStructuredText/Sphinx.
2021-12-10 Jay Berkenbilt <[email protected]>
* Handle bitstream overflow errors more gracefully. Fixes #581.
* C API: add qpdf_get_object_by_id, qpdf_make_indirect_object, and
qpdf_replace_object, exposing the corresponding methods in QPDF
and QPDFObjectHandle. Fixes #588.
* Add missing QPDF_DLL to QPDFObjectHandle::addTokenFilter so that
it is actually accessible as part of the public interface as
intended. Fixes #580.
* C API: Overhaul how errors are handle the C API's object handle
interfaces. Clarify documentation regarding object accessors and
how type errors and warnings are handled. Many cases that used to
crash code that used the C API can now be trapped and will be
written stderr if not trapped. See qpdf-c.h for details.
* C API: Add qpdf_oh_new_uninitialized to explicitly create
uninitialized object handles.
* Add new error code qpdf_e_object that is used for exceptions
(including warnings) that are caused by using QPDFObjectHandle
methods on object handles of the wrong type.
2021-12-02 Jay Berkenbilt <[email protected]>
* C API: Add qpdf_oh_is_initialized.
* C API: Add qpdf_get_last_string_length to return the length of
the last string returned. This is necessary in order to fully
retrieve values of strings that may contain embedded null characters.
* C API: Add qpdf_oh_new_object to clone an object handle. Change
implemented by m-holger in #587.
2021-11-16 Jay Berkenbilt <[email protected]>
* 10.4.0: release
2021-11-10 Jay Berkenbilt <[email protected]>
* Add --allow-weak-crypto option to suppress warnings about use of
weak cryptographic algorithms. Update documentation around this
issue. Fixes #358.
2021-11-07 Jay Berkenbilt <[email protected]>
* Relax xref recovery logic a bit so that files whose objects are
either missing endobj or have endobj at other than the beginning
of a line can still be recovered. Fixes #573.
2021-11-04 Jay Berkenbilt <[email protected]>
* Add support for OpenSSL 3. Fixes #568.
The OpenSSL version is detected at compile-time. If you want to
build with OpenSSL 3 on a system that has OpenSSL 1 installed, you
can run configure like this (or similar to this depending on how
you installed openssl3):
pc_openssl_CFLAGS=-I/path/to/openssl3/include \
pc_openssl_LIBS='-L/path/to/openssl3/lib64 -lssl -lcrypto' \
./configure
where /path/to/openssl3 is wherever your OpenSSL 3 distribution is
installed. You may also need to set the LD_LIBRARY_PATH
environment variable if it's not installed in a standard location.
* Add range check in QPDFNumberTreeObjectHelper (fuzz issue 37740).
* Add QIntC::range_check_subtract to do range checking on
subtraction, which has different boundary conditions from
addition.
* Bug fix: fix crash that could occur under certain conditions
when using --pages with files that had form fields. Fixes #548.
* Add an extra check to the library to detect when foreign objects
are inserted directly (instead of using
<function>QPDF::copyForeignObject</function>) at the time of
insertion rather than when the file is written. Catching the error
sooner makes it much easier to locate the incorrect code.
2021-11-03 Jay Berkenbilt <[email protected]>
* Bug fix: make overlay/underlay work on a page with no resource
dictionary. Fixes #527.
2021-11-02 Jay Berkenbilt <[email protected]>
* Add QPDF::findPage to the public API. This is primarily to help
improve the efficiency of code that wraps the qpdf library, such
as pikepdf. Fixes #516.
* zlib-flate: warn and exit with code 3 when there is corrupted
input data even when decompression is possible. We do this in the
zlib-flate CLI so that it can be more reliably used to test the
validity of zlib streams, but we don't warn by default in qpdf
itself because PDF files in the wild exist with this problem and
other readers appear to tolerate it. There is a PDF in the qpdf
test suite (form-filled-by-acrobat.pdf) that was written by a
version of Adobe Acrobat that exhibits this problem. Fixes #562.
* Add Pl_Flate::setWarnCallback to make it possible to be notified
of data errors that are recoverable but still indicate invalid
data.
* Improve error reporting when someone forgets the -- after
--pages. Fixes #555.
2021-05-12 Jay Berkenbilt <[email protected]>
* Bug fix: ensure we don't overflow any string bounds while
handling completion, even when we are given bogus input values.
Fixes #441.
2021-05-09 Jay Berkenbilt <[email protected]>
* Improve performance of preservation of object streams by
avoiding unnecessary traversal of objects when there are no object
streams.
2021-05-08 Jay Berkenbilt <[email protected]>
* 10.3.2: release
* Fix problem that caused the generated manual from being included
in the Windows distributions. Fixes #521.
* Fix 11-year-old bug of leaving unreferenced objects in preserved
object streams. Fixes #520.
2021-04-17 Jay Berkenbilt <[email protected]>
* Portability fix: use tm_gmtoff rather than global timezone
variable if available to get timezone offset. This fixes
compilation on BSD and also results in a daylight saving
time-aware offset for Linux or other GNU systems. Fixes #515.
2021-04-05 Jay Berkenbilt <[email protected]>
* When adding a page, if the page already exists, make a shallow
copy of the page instead of throwing an exception. This makes the
behavior of adding a page from the library consistent with what
the CLI does and also with what the library does if it starts with
a file that already has a duplicated page. Note that this means
that, in some cases, the page you pass to addPage or addPageAt
(either in QPDF or QPDFPageDocumentHelper) will not be the same
object that actually gets added. (This has actually always been
the case.) That means that, if you are going to do subsequent
modification on the page, you should retrieve it again.
2021-03-11 Jay Berkenbilt <[email protected]>
* 10.3.1: release
* Bug fix: allow /DR to be direct in /AcroForm
2021-03-04 Jay Berkenbilt <[email protected]>
* 10.3.0: release
* The last several changes are in support of fixing more complex
cases of keeping form fields working properly through page copying
operations. Fixes #509.
* Deprecated QPDFAcroFormDocumentHelper::copyFieldsFromForeignPage
-- use QPDFAcroFormDocumentHelper::fixCopiedAnnotations instead.
The API for dealing with annotations and form fields around
copying pages is extremely complex and very hard to get right. It
is planned for a future version of qpdf to have a higher level
interface for dealing with copying pages around and preserving
document-level constructs.
* Add QPDFAcroFormDocumentHelper::getFieldsWithQualifiedName for
returning a list of fields by name.
* Add QPDFAcroFormDocumentHelper::addAndRenameFormFields to add a
collection of fields while ensuring that, within the collection,
fields with the same name continue to have the same name, but that
they don't conflict with exiting fields in the document.
* Add QPDFAcroFormDocumentHelper::setFormFieldName for changing
the name of a form field in a manner that preserves
QPDFAcroFormDocumentHelper's cache.
2021-03-03 Jay Berkenbilt <[email protected]>
* Handle /DR properly when copying form fields. This is a
significant rework of the form field copying from 10.2.0. It
ensures that when copy fields from different files, we resolve any
conflicting names in resources.
* Add QPDFMatrix::operator==
* Add QPDFObjectHandle::makeResourcesIndirect
2021-03-02 Jay Berkenbilt <[email protected]>
* Add an optional resource_names argument to getUniqueResourceName
for added efficiency.
* Add conflict detection QPDFObjectHandle::mergeResources.
2021-03-01 Jay Berkenbilt <[email protected]>
* Improve code that finds unreferenced resources to ignore names
in the content stream that are not fonts or XObjects. This should
reduce the number of cases when qpdf needlessly decides not to
remove unreferenced resources. Hopefully it doesn't create any new
bugs where it removes unreferenced resources that it isn't
supposed to.
* Add QPDF::numWarnings() -- useful to tell whether any warnings
were issued by a specific bit of code.
2021-02-26 Jay Berkenbilt <[email protected]>
* Bug fix: QPDFFormFieldObjectHelper was mis-handling /DA, /Q, and
/DR in ways that usually didn't matter but were still wrong. /DA
and /Q were being found in the field hierarchy, but if not found,
the default values in the /AcroForm dictionary were not being
used. /DR was being treated as an inherited field in the field
dictionary, which is wrong. It is actually supposed to come from
the /AcroForm dictionary. We were getting away with this since
many popular form writers seem to copy it to the field as well,
even though the spec makes no mention of doing this. To support
this, QPDFFormFieldObjectHelper::getDefaultResources was added.
2021-02-25 Jay Berkenbilt <[email protected]>
* Update StreamDataProvider examples to use copyStream() when they
want to get to the original stream data from the provider. Prior
to 10.2.0, we had to copy the stream to another QPDF, but now we
can just use copyStream().
* Bug fix/behavior change: when QPDF::replaceObject or
QPDF::swapObjects is called, existing QPDFObjectHandle instances
will now notice the change. This removes a long-standing source of
bugs and confusing behavior.
2021-02-23 Jay Berkenbilt <[email protected]>
* 10.2.0: release
* The test for the input and output files being the same wasn't
implemented correctly for --split-pages since the specified output
file is really a pattern, not the actual output file.
2021-02-22 Jay Berkenbilt <[email protected]>
* From qpdf CLI, --pages and --split-pages will properly preserve
interactive form functionality. Fixes #340.
* Add QPDFAcroFormDocumentHelper::copyFieldsFromForeignPage to
copy form fields from a foreign page into the current file. (This
method didn't work and was deprecated in 10.3.0.)
* Add QPDFFormFieldObjectHelper::getTopLevelField to get the
top-level field for a given form field.
* Update pdf-overlay-page example to include copying of
annotations.
* Add a new version of QPDFPageObjectHelper::placeFormXObject that
initializes the transformation matrix that was used so you don't
have to call both placeFormXObject and
getMatrixForFormXObjectPlacement.
2021-02-21 Jay Berkenbilt <[email protected]>
* From qpdf CLI, --overlay and --underlay will copy annotations
and form fields from overlay/underlay file. Fixes #395.
* Add QPDFPageObjectHelper::copyAnnotations, which copies
annotations and, if applicable, associated form fields, from one
page to another, possibly transforming the rectangles.
* Bug fix: --flatten-rotation now applies the required
transformation to annotations on the page.
* Add QPDFAcroFormDocumentHelper::transformAnnotations to apply a
transformation to a group of annotations.
* Add QPDFObjGen::unparse()
* Add QPDFObjectHandle::copyStream() for making a copy of a stream
within the same QPDF instance.
* Allow QPDFObjectHandle::newArray and
QPDFObjectHandle::newFromMatrix take QPDFMatrix as well as
QPDFObjectHandle::Matrix
* Make member variables a--f of QPDFMatrix public
2021-02-20 Jay Berkenbilt <[email protected]>
* Allow --rotate=0 to clear rotation from a page.
2021-02-18 Jay Berkenbilt <[email protected]>
* Add QPDFAcroFormDocumentHelper::addFormField, which adds a new
form field, initializing the AcroForm dictionary if needed.
* Add QPDFPageObjectHelper::getMatrixForFormXObjectPlacement,
which returns the transformation matrix required to map from a
form field's coordinate system into a specific rectangle within
the page.
* Add QUtil::path_basename to get last element of a path.
* Add examples/pdf-attach-file.cc to illustrate new file
attachment method and also new parse that takes indirect objects.
2021-02-17 Jay Berkenbilt <[email protected]>
* Allow optional numeric argument to --collate. If --collate=n is
given, pull n pages from the first file, n pages from the second
file, etc., until we run out of pages.
2021-02-15 Jay Berkenbilt <[email protected]>
* Add a version of QPDFObjectHandle::parse that takes a QPDF* as
context so that it can parse strings containing indirect object
references.
2021-02-14 Jay Berkenbilt <[email protected]>
* Add new versions of QPDFObjectHandle::replaceStreamData that
take std::function objects for cases when you need something
between a static string and a full-fledged StreamDataProvider.
Using this with QUtil::file_provider is a very easy way to create
a stream from the contents of a file.
2021-02-12 Jay Berkenbilt <[email protected]>
* Move formerly internal QPDFMatrix class to the public API. This
class provides convenience methods for working with transformation
matrices.
* QUtil::double_to_string: trim trailing zeroes by default, and
add option to not trim trailing zeroes. This causes a syntactic
but semantically preserving change in output when doubles are
converted to strings. The library uses double_to_string in only a
few places. In practice, output will be different (trailing zeroes
removed) in code that creates form XObjects (mostly generation of
appearance streams for form fields as well as overlay and
underlay) and in the flatten rotation code that was added in qpdf
10.1.
2021-02-10 Jay Berkenbilt <[email protected]>
* Require a C++-14 compiler.
* Detect loops when adding when reading outlines dictionary upon
initialization of QPDFOutlineDocumentHelper (fuzz issue 30507).
* Add "attachments" as an additional json key, and add some
information about attachments to the json output.
* Add new command-line arguments for operating on attachments:
--list-attachments, --add-attachment, --remove-attachment,
--copy-attachments-from. See --help and manual for details.
2021-02-09 Jay Berkenbilt <[email protected]>
* Add methods to QUtil for working with PDF timestamp strings:
pdf_time_to_qpdf_time, qpdf_time_to_pdf_time,
get_current_qpdf_time.
2021-02-08 Jay Berkenbilt <[email protected]>
* Add helper classes for file attachments:
QPDFEmbeddedFileDocumentHelper, QPDFFileSpecObjectHelper,
QPDFEFStreamObjectHelper. See their header files for details.
2021-02-07 Jay Berkenbilt <[email protected]>
* Add new functions QUtil::pipe_file and QUtil::file_provider for
sending the contents of a file through a pipeline as binary data.
2021-02-04 Jay Berkenbilt <[email protected]>
* Add new option --password-file=file for reading the decryption
password from a file. file may be "-" to read from standard input.
Fixes #499.
* By default, give an error if a user attempts to encrypt a file
with a 256-bit key, a non-empty user password, and an empty owner
password. Such files are insecure since they can be opened with no
password. To allow explicit creation of files like this, pass the
new --allow-insecure option. Thanks to github user RobK88 for a
detailed analysis and for reporting this issue. Fixes #501.
2021-02-02 Jay Berkenbilt <[email protected]>
* Bug fix: if a form XObject lacks a resources dictionary,
consider any names in that form XObject to be referenced from the
containing page. This is compliant with older PDF versions. Also
detect if any form XObjects have any unresolved names and, if so,
don't remove unreferenced resources from them or from the page
that contains them. Fixes #494.
2021-01-31 Jay Berkenbilt <[email protected]>
* Bug fix: properly handle strings if they appear in inline image
dictionaries while externalizing inline images.
2021-01-30 Jay Berkenbilt <[email protected]>
* Add examples/pdf-name-number-tree.cc to illustrate new
name/number tree API and new array/dictionary iterator API.
2021-01-29 Jay Berkenbilt <[email protected]>
* Add methods to QPDFObjectHandle that provide a C++ iterator API,
including C++11 range-for iteration, over arrays and dictionaries.
With this, you can do
for (auto i: dict_oh.ditems())
{
// i.first is a string, i.second is a QPDFObjectHandle
}
for (auto i: array_oh.aitems())
{
// i is a QPDFObjectHandle
}
* QPDFObjectHandle::is* methods to check type now return false on
uninitialized objects rather than crashing or throwing a logic
error.
2021-01-24 Jay Berkenbilt <[email protected]>
* Implement remove for name and number trees as well as exposing
remove and insertAfter methods for iterators. With this addition,
qpdf now has robust read/write support for name and number trees.
2021-01-23 Jay Berkenbilt <[email protected]>
* Add an insert method to QPDFNameTreeObjectHelper and
QPDFNumberTreeObjectHelper.
* QPDFNameTreeObjectHelper and QPDFNumberTreeObjectHelper will
automatically repair broken name and number trees by default. This
behavior can be turned off.
* Change behavior of QPDFObjectHandle::newUnicodeString so that it
encodes ASCII or PDFDocEncoding if those encodings will support
all the characters in the string, resorting to UTF-16 only if the
other encodings are insufficient. This is a cleaner implementation
of the intention of encoding strings for use outside of contents
and results in fewer instances of ASCII strings being needlessly
encoded as UTF-16. This change may cause qpdf to generate
different output from the same input when form field values are
set using methods from QPDFFormFieldObjectHelper.
2021-01-16 Jay Berkenbilt <[email protected]>
* Add new constructors for QPDFNameTreeObjectHelper and
QPDFNumberTreeObjectHelper that take a QPDF object so they can
create indirect objects and issue warnings. The old constructors
are deprecated and will be removed in qpdf 11. Just pass in the
owning QPDF of the object handle used to initialize the helpers.
* Re-implement QPDFNameTreeObjectHelper and
QPDFNumberTreeObjectHelper to be much more efficient and to have
an iterator-based API in addition to the existing one. This makes
it possible to use "range-for" loops over these helpers and to
iterate through name and number trees without creating a map
containing all the keys and values, which is slow and potentially
consumes a lot of memory.
* Add warn() to QPDF's public API.
2021-01-11 Jay Berkenbilt <[email protected]>
* Fix very old error in code that was finding attachment streams.
Probably this error never mattered, but the code was still not
exactly right.
2021-01-06 Jay Berkenbilt <[email protected]>
* Give warnings instead of segfaulting if a QPDF operation is
attempted after calling closeInputSource(). Fixes #495.
2021-01-05 Jay Berkenbilt <[email protected]>
* 10.1.0: release
2021-01-04 Jay Berkenbilt <[email protected]>
* When qpdf CLI extracts pages, it now only attempts to remove
unreferenced resources from the pages that it is keeping. This
change dramatically reduces the time it takes to extract a small
number of pages from a large, complex file.
* Move getNext()->write() calls in some pipelines to ensure that
state gates properly reset even if the next pipeline's write
throws an exception (fuzz issue 28262).
2021-01-03 Jay Berkenbilt <[email protected]>
* Don't include -o nospace with zsh completion setup so file
completion works normally. Fixes #473.
2021-01-02 Jay Berkenbilt <[email protected]>
* Make QPDFPageObjectHelper methods pipeContents, parseContents,
and addContentTokenFilter work with form XObjects.
* Rename some QPDFPageObjectHelper methods and make them support
form XObjects as well as pages. The old names will be preserved
from compatibility.
- pipePageContents -> pipeContents
- parsePageContents -> parseContents
* Add QPDFObjectHandle::parseAsContents to apply ParserCallbacks
to a form XObject.
* QPDFPageObjectHelper::externalizeInlineImages can be called with
form XObjects as well as pages.
* Bug fix: QPDFPageObjectHelper::externalizeInlineImages was not
descending into form XObjects on a page. It now does this by
default. In the extremely unlikely event that anyone was actually
depending on the old behavior, it is available by passing
shallow=true to the externalizeInlineImages call.
* Bug fix: QPDFObjectHandle::filterPageContents was broken for
pages with an array of content streams. This caused
externalize-inline-images to also be broken for this case.
2021-01-01 Jay Berkenbilt <[email protected]>
* Add methods to QPDFPageObjectHelper: forEachXObject,
forEachImage, forEachFormXObject to call a function on each
XObject (or image or form XObject) in a page or form XObject,
possibly recursing into nested form XObjects.
* Add method QPDFPageObjectHelper::getFormXObjects to return a map
of keys to form XObjects (non-recursively) from a page or form
XObject.
* Add method QPDFObjectHandle::isImage to test whether an object
is an image.
2020-12-31 Jay Berkenbilt <[email protected]>
* QPDFPageObjectHelper::removeUnreferencedResources can now be
called with a QPDFPageObjectHelper created from a form XObject.
The method already recursed into form XObjects.
* Rename some QPDFPageObjectHelper methods and make them support
form XObjects as well as pages. The old names will be preserved
from compatibility.
- getPageImages -> getImages
- filterPageContents -> filterContents
* Add QPDFObjectHandle::isFormXObject to test whether an object is
a form XObject.
2020-12-30 Jay Berkenbilt <[email protected]>
* Add QPDFPageObjectHelper::flattenRotation and --flatten-rotation
option to the qpdf CLI. The flattenRotation method removes any
/Rotate key from a page dictionary and implements the same
rotation by modifying the page's contents such that the various
page boxes are altered and the page renders identically. This can
be used to work around buggy PDF applications that don't properly
handle page rotation. The --flatten-rotation option to the qpdf
CLI calls flattenRotation for every page.
2020-12-26 Jay Berkenbilt <[email protected]>
* Add QPDFObjectHandle::setFilterOnWrite, which can be used to
tell QPDFWriter not to filter a stream on output even if it can.
You can use this to prevent QPDFWriter from touching a stream
(either uncompressing or compressing) that you have optimized or
otherwise ensured looks exactly the way you want it, even if
decode level or stream compression would otherwise cause
QPDFWriter to modify the stream.
* Add ostream << for QPDFObjGen. (Don't ask why it took 7.5 years
for me to decide to do this.)
2020-12-25 Jay Berkenbilt <[email protected]>
* Refactor write code to eliminate an extra full traversal of
objects in the file and to remove assumptions that preclude stream
references from appearing in /DecodeParms of filterable streams.
This results in an approximately 8% performance reduction in write
times.
2020-12-23 Jay Berkenbilt <[email protected]>
* Allow library users to provide their own decoders for stream
filters by deriving classes from QPDFStreamFilter and registering
them using QPDF::registerStreamFilter. Registered stream filters
provide code to validate and interpret /DecodeParms for a specific
/Filter and also to provide a pipeline that will decode. Note that
it is possible to encode to a filter type that is not supported
even without this feature. See examples/pdf-custom-filter.cc for
an example of using custom stream filters.
2020-12-22 Jay Berkenbilt <[email protected]>
* Add QPDFObjectHandle::makeDirect(bool allow_streams) -- if
allow_streams is true, preserve indirect references to streams
rather than throwing an exception. This allows the object to be
made as direct as possible while preserving stream references.
2020-12-20 Jay Berkenbilt <[email protected]>
* Add qpdf_register_progress_reporter method to C API,
corresponding to QPDFWriter::registerProgressReporter. Fixes #487.
2020-11-28 Jay Berkenbilt <[email protected]>
* Add new functions to the C API for manipulating
QPDFObjectHandles. The new functions allow creation and
modification of objects, which brings a lot of additional power to
the C API. See include/qpdf/qpdf-c.h for details and
examples/pdf-c-objects.c for a simple example.
2020-11-21 Jay Berkenbilt <[email protected]>
* 10.0.4: release
* Fix QIntC::range_check to handle negative numbers properly (fuzz
issue 26994).
2020-11-11 Jay Berkenbilt <[email protected]>
* Treat a direct page object as a runtime error rather than a
logic error since it is actually possible to create a file that
has this (fuzz issue 27393).
2020-11-09 Jay Berkenbilt <[email protected]>
* Handle "." appearing in --pages not preceded by a numeric range
as a special case in command-line parsing code.
2020-11-04 Jay Berkenbilt <[email protected]>
* Ignore the value of the offset/generation field in an xref entry
for a deleted object. Also attempt file recovery on lower-level
exceptions thrown while reading the xref table. Fixes #482.
2020-10-31 Jay Berkenbilt <[email protected]>
* 10.0.3: release
* Don't enter extension initialization in QPDFWriter on a direct
object. Fixes stack overflow in pathological case of /Root being a
direct object (fuzz issue 26761).
* My previous fix to #449 (handling foreign streams with indirect
objects in /Filter and/or /DecodeParms) was incorrect and caused
other problems. There is a now a correct fix to the original
problem. Fixes #478.
2020-10-27 Jay Berkenbilt <[email protected]>
* 10.0.2: release
2020-10-25 Jay Berkenbilt <[email protected]>
* When signing distribution files, generate sha256 checksums
instead of md5, sha1, and sha512. sha256 seems to be more widely
used, and there's no reason to use md5 or sha1 anymore.
* Official Windows releases are now built using the openssl crypto
provider. The native provider is still available for selection at
runtime using the QPDF_CRYPTO_PROVIDER environment variable.
* Bug fix: --no-warn was not suppressing some warnings that might
be generated by --split-pages.
2020-10-23 Jay Berkenbilt <[email protected]>
* Bug fix: when concatenating content streams, insert a newline if
needed to prevent the last token from the old stream from being
merged with the first token of the new stream. Qpdf was mistakenly
concatenating the streams without regard to the specification that
content streams are to be broken on token boundaries. Fixes #444.
* fix-qdf: handle empty streams better with ignore newline by
treating them as empty even though, technically, a blank line
would be required inside the Stream. This just makes it easier to
add place-holder empty streams while editing qdf files by hand.
2020-10-22 Jay Berkenbilt <[email protected]>
* Fix memory leak that could occur if objects in object streams
were resolved more than once and the objects within the object
streams contained circular references. This leak could be
triggered when qpdf was run with --object-streams=generate on
files that already had object streams containing circular
references (fuzz issue 23642).
* Add QIntC::range_check for checking to see whether adding two
numbers together will cause an overflow.
* Fix loop detection problem when traversing page thumbnails
during optimization (fuzz issue 23172).
2020-10-21 Jay Berkenbilt <[email protected]>
* Bug fix: properly handle copying foreign streams that have
indirect /Filter or /DecodeParms keys when stream data has been
replaced. The circumstances leading to this bug are very unusual
but would cause qpdf to either generate an internal error or some
other kind of warning situation if it would occur. Fixes #449.
* Qpdf's build and CI has been migrated from Azure Pipelines
(Azure DevOps) to GitHub Actions.
* Remove some fuzz files that triggered Mal/PDFEx-H with some
virus scanners. There's plenty of coverage in the fuzz corpus
without these files, and it's a nuisance to have virus checkers
remove them. Fixes #460.
* Ensure that numeric conversion is not affected by the user's
global locale setting. Fixes #459.
* Add qpdf-<version>-linux-x86_64.zip to the list of built
distributions. This is a simple zip file that contains just the
qpdf executables and the dependent shared libraries that would not
ordinarily be present on a base system. This minimal binary
distribution works as is when used as a Lambda layer in AWS and
could be suitable for inclusion in a docker image or other
standalone Linux/x86_64 environment where you want minimal support
for running the qpdf executable. Fixes #352.
2020-10-20 Jay Berkenbilt <[email protected]>
* Add --warning-exit-0 option to the qpdf command line. When
specified, qpdf will exit with a status of 0 rather than 3 when
there are warnings without errors. Combine with --no-warn to
completely ignore warnings.
* Bug fix: fix further cases in which errors were written to
stdout. Fixes #438.
* Build option: add --disable-rpath option to ./configure, which
disables passing -rpath to the linker when building shared
libraries with libtool. Fixes #422.
2020-10-16 Jay Berkenbilt <[email protected]>
* Accept pull request that improves how the Windows native crypto
provider is obtained.
* Accept pull request that improves performance in processing
files in memory.
* Accept pull requests that improve openssl configuration and
error reporting.
* Build using GitHub Actions. The intention is that this will
replace Azure Pipelines as the official CI for qpdf for the next
release.
2020-10-15 Jay Berkenbilt <[email protected]>
* Make many minor improvements to the build process and code
health, including fixing a lgtm warning and compiler warnings from
newer version of gcc and MSVC toolchains. Add several cosmetic
improvements to build output in CI.
* Added LL_FMT to config.h.in. This is populated automatically by
autoconf, but if build with your own build system, you may need to
define it as whatever the format string needed by printf for long
long is. Usually this is "%lld", but it can be "%I64d" for some
older Windows-based compilers.
2020-04-29 Jay Berkenbilt <[email protected]>
* Bug fix: qpdf --check was writing errors and warnings reported
by checkLinearization to stdout instead of stderr. Fixes #438.
2020-04-09 Jay Berkenbilt <[email protected]>
* 10.0.1: release