Preserve annotations that inherently lack appearance (fixes #1039)

...when flattening annotations. This includes /Link, /Popup,
and /Projection.
This commit is contained in:
Jay Berkenbilt 2023-12-29 13:35:29 -05:00
parent 1ad6451e8c
commit 78a7193fe2
11 changed files with 3545 additions and 3113 deletions

View File

@ -1,3 +1,9 @@
2023-12-29 Jay Berkenbilt <ejb@ql.org>
* When flattening annotations, preserve annotations without any
appearance information at all, such as types /Link, /Popup, and
/Projection. Fixes #1039.
2023-12-25 Jay Berkenbilt <ejb@ql.org>
* Detect overlong UTF-8 in the UTF-8 decoder, and fix detection of

View File

@ -125,11 +125,12 @@ QPDFPageDocumentHelper::flattenAnnotationsForPage(
++next_fx;
}
new_content += content;
} else if (process) {
// If an annotation has no appearance stream, just drop the annotation when flattening.
// This can happen for unchecked checkboxes and radio buttons, popup windows associated
// with comments that aren't visible, and other types of annotations that aren't
// visible.
} else if (process && !aoh.getAppearanceDictionary().isNull()) {
// If an annotation has no selected appearance stream, just drop the annotation when
// flattening. This can happen for unchecked checkboxes and radio buttons, popup windows
// associated with comments that aren't visible, and other types of annotations that
// aren't visible. Annotations that have no appearance streams at all, such as Link,
// Popup, and Projection, should be preserved.
QTC::TC("qpdf", "QPDFPageDocumentHelper ignore annotation with no appearance");
} else {
new_annots.push_back(aoh.getObjectHandle());

View File

@ -38,6 +38,12 @@ Planned changes for future 12.x (subject to change):
.. x.y.z: not yet released
11.7.1: not yet released
- Bug fixes:
- When flattening annotations, preserve hyperlinks and other
annotations that inherently have no appearance information.
11.7.0: December 24, 2023
- Bug fixes:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -22,10 +22,13 @@ endobj
%% Page 1
3 0 obj
<<
/Contents [
/Annots [
4 0 R
6 0 R
8 0 R
]
/Contents [
5 0 R
7 0 R
9 0 R
]
/MediaBox [
0
@ -36,35 +39,51 @@ endobj
/Parent 2 0 R
/Resources <<
/Font <<
/F1 10 0 R
/F1 11 0 R
>>
/ProcSet 11 0 R
/ProcSet 12 0 R
/XObject <<
/Fxo1 12 0 R
/Fxo1 13 0 R
>>
>>
/Type /Page
>>
endobj
%% Contents for page 1
4 0 obj
<<
/Length 5 0 R
/F 28
/Open false
/Parent 15 0 R
/Rect [
612
601
792
721
]
/Subtype /Popup
/Type /Annot
>>
endobj
%% Contents for page 1
5 0 obj
<<
/Length 6 0 R
>>
stream
q
endstream
endobj
5 0 obj
6 0 obj
2
endobj
%% Contents for page 1
6 0 obj
7 0 obj
<<
/Length 7 0 R
/Length 8 0 R
>>
stream
BT
@ -75,14 +94,14 @@ ET
endstream
endobj
7 0 obj
8 0 obj
44
endobj
%% Contents for page 1
8 0 obj
9 0 obj
<<
/Length 9 0 R
/Length 10 0 R
>>
stream
@ -94,11 +113,11 @@ Q
endstream
endobj
9 0 obj
10 0 obj
35
endobj
10 0 obj
11 0 obj
<<
/BaseFont /Helvetica
/Encoding /WinAnsiEncoding
@ -108,14 +127,14 @@ endobj
>>
endobj
11 0 obj
12 0 obj
[
/PDF
/Text
]
endobj
12 0 obj
13 0 obj
<<
/BBox [
0
@ -136,7 +155,7 @@ endobj
>>
/Subtype /Form
/Type /XObject
/Length 13 0 R
/Length 14 0 R
>>
stream
q 1 1 1 rg 0 i 1 w 4 M 1 j 0 J []0 d /GS0 gs 1 0 0 1 9 5.0908 cm 7.74 12.616 m -7.74 12.616 l -8.274 12.616 -8.707 12.184 -8.707 11.649 c -8.707 -3.831 l -8.707 -4.365 -8.274 -4.798 -7.74 -4.798 c 7.74 -4.798 l 8.274 -4.798 8.707 -4.365 8.707 -3.831 c 8.707 11.649 l 8.707 12.184 8.274 12.616 7.74 12.616 c h f Q 0 G 1 1 0 rg 0 i 0.60 w 4 M 1 j 0 J []0 d 1 1 0 rg 0 G 0 i 0.59 w 4 M 1 j 0 J []0 d 1 0 0 1 9 5.0908 cm 0 0 m -0.142 0 -0.28 0.008 -0.418 0.015 c -2.199 -1.969 -5.555 -2.242 -4.642 -1.42 c -4.024 -0.862 -3.916 0.111 -3.954 0.916 c -5.658 1.795 -6.772 3.222 -6.772 4.839 c -6.772 7.509 -3.74 9.674 0 9.674 c 3.74 9.674 6.772 7.509 6.772 4.839 c 6.772 2.167 3.74 0 0 0 c 7.74 12.616 m -7.74 12.616 l -8.274 12.616 -8.707 12.184 -8.707 11.649 c -8.707 -3.831 l -8.707 -4.365 -8.274 -4.798 -7.74 -4.798 c 7.74 -4.798 l 8.274 -4.798 8.707 -4.365 8.707 -3.831 c 8.707 11.649 l 8.707 12.184 8.274 12.616 7.74 12.616 c b
@ -144,31 +163,63 @@ endstream
endobj
%QDF: ignore_newline
13 0 obj
14 0 obj
928
endobj
15 0 obj
<<
/AP <<
/N 13 0 R
>>
/C [
1
1
0
]
/CA 1
/Contents (Salad)
/CreationDate (D:20181231235455Z00'00)
/F 28
/M (D:20181231235455Z00'00)
/Name /Comment
/P 3 0 R
/Popup 4 0 R
/Rect [
235
703
253
721
]
/Subtype /Text
/T (Jay Berkenbilt)
/Type /Annot
>>
endobj
xref
0 14
0 16
0000000000 65535 f
0000000025 00000 n
0000000079 00000 n
0000000161 00000 n
0000000450 00000 n
0000000507 00000 n
0000000548 00000 n
0000000647 00000 n
0000000689 00000 n
0000000779 00000 n
0000000798 00000 n
0000000917 00000 n
0000000953 00000 n
0000002197 00000 n
0000000453 00000 n
0000000616 00000 n
0000000673 00000 n
0000000714 00000 n
0000000813 00000 n
0000000855 00000 n
0000000946 00000 n
0000000966 00000 n
0000001085 00000 n
0000001121 00000 n
0000002365 00000 n
0000002386 00000 n
trailer <<
/Root 1 0 R
/Size 14
/Size 16
/ID [<c5b1999a07a3fdcd0c04cfeed299c25a><31415926535897932384626433832795>]
>>
startxref
2218
2716
%%EOF

View File

@ -22,10 +22,11 @@ endobj
%% Page 1
3 0 obj
<<
/Annots 4 0 R
/Contents [
4 0 R
6 0 R
8 0 R
5 0 R
7 0 R
9 0 R
]
/MediaBox [
0
@ -36,35 +37,41 @@ endobj
/Parent 2 0 R
/Resources <<
/Font <<
/F1 10 0 R
/F1 11 0 R
>>
/ProcSet 11 0 R
/ProcSet 12 0 R
/XObject <<
/Fxo1 12 0 R
/Fxo1 13 0 R
>>
>>
/Type /Page
>>
endobj
%% Contents for page 1
4 0 obj
[
15 0 R
]
endobj
%% Contents for page 1
5 0 obj
<<
/Length 5 0 R
/Length 6 0 R
>>
stream
q
endstream
endobj
5 0 obj
6 0 obj
2
endobj
%% Contents for page 1
6 0 obj
7 0 obj
<<
/Length 7 0 R
/Length 8 0 R
>>
stream
BT
@ -75,14 +82,14 @@ ET
endstream
endobj
7 0 obj
8 0 obj
44
endobj
%% Contents for page 1
8 0 obj
9 0 obj
<<
/Length 9 0 R
/Length 10 0 R
>>
stream
@ -94,11 +101,11 @@ Q
endstream
endobj
9 0 obj
10 0 obj
35
endobj
10 0 obj
11 0 obj
<<
/BaseFont /Helvetica
/Encoding /WinAnsiEncoding
@ -108,14 +115,14 @@ endobj
>>
endobj
11 0 obj
12 0 obj
[
/PDF
/Text
]
endobj
12 0 obj
13 0 obj
<<
/BBox [
0
@ -136,7 +143,7 @@ endobj
>>
/Subtype /Form
/Type /XObject
/Length 13 0 R
/Length 14 0 R
>>
stream
q 1 1 1 rg 0 i 1 w 4 M 1 j 0 J []0 d /GS0 gs 1 0 0 1 9 5.0908 cm 7.74 12.616 m -7.74 12.616 l -8.274 12.616 -8.707 12.184 -8.707 11.649 c -8.707 -3.831 l -8.707 -4.365 -8.274 -4.798 -7.74 -4.798 c 7.74 -4.798 l 8.274 -4.798 8.707 -4.365 8.707 -3.831 c 8.707 11.649 l 8.707 12.184 8.274 12.616 7.74 12.616 c h f Q 0 G 1 1 0 rg 0 i 0.60 w 4 M 1 j 0 J []0 d 1 1 0 rg 0 G 0 i 0.59 w 4 M 1 j 0 J []0 d 1 0 0 1 9 5.0908 cm 0 0 m -0.142 0 -0.28 0.008 -0.418 0.015 c -2.199 -1.969 -5.555 -2.242 -4.642 -1.42 c -4.024 -0.862 -3.916 0.111 -3.954 0.916 c -5.658 1.795 -6.772 3.222 -6.772 4.839 c -6.772 7.509 -3.74 9.674 0 9.674 c 3.74 9.674 6.772 7.509 6.772 4.839 c 6.772 2.167 3.74 0 0 0 c 7.74 12.616 m -7.74 12.616 l -8.274 12.616 -8.707 12.184 -8.707 11.649 c -8.707 -3.831 l -8.707 -4.365 -8.274 -4.798 -7.74 -4.798 c 7.74 -4.798 l 8.274 -4.798 8.707 -4.365 8.707 -3.831 c 8.707 11.649 l 8.707 12.184 8.274 12.616 7.74 12.616 c b
@ -144,31 +151,80 @@ endstream
endobj
%QDF: ignore_newline
13 0 obj
14 0 obj
928
endobj
15 0 obj
<<
/F 28
/Open false
/Parent 16 0 R
/Rect [
612
601
792
721
]
/Subtype /Popup
/Type /Annot
>>
endobj
16 0 obj
<<
/AP <<
/N 13 0 R
>>
/C [
1
1
0
]
/CA 1
/Contents (Salad)
/CreationDate (D:20181231235455Z00'00)
/F 28
/M (D:20181231235455Z00'00)
/Name /Comment
/P 3 0 R
/Popup 15 0 R
/Rect [
235
703
253
721
]
/Subtype /Text
/T (Jay Berkenbilt)
/Type /Annot
>>
endobj
xref
0 14
0 17
0000000000 65535 f
0000000025 00000 n
0000000079 00000 n
0000000161 00000 n
0000000450 00000 n
0000000507 00000 n
0000000548 00000 n
0000000647 00000 n
0000000689 00000 n
0000000779 00000 n
0000000798 00000 n
0000000917 00000 n
0000000953 00000 n
0000002197 00000 n
0000000443 00000 n
0000000495 00000 n
0000000552 00000 n
0000000593 00000 n
0000000692 00000 n
0000000734 00000 n
0000000825 00000 n
0000000845 00000 n
0000000964 00000 n
0000001000 00000 n
0000002244 00000 n
0000002265 00000 n
0000002406 00000 n
trailer <<
/Root 1 0 R
/Size 14
/Size 17
/ID [<c5b1999a07a3fdcd0c04cfeed299c25a><31415926535897932384626433832795>]
>>
startxref
2218
2737
%%EOF

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff