From b60c00f4adec9ea4b75af0226b04a7125e166ae2 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 4 Jan 2024 11:06:22 -0700 Subject: QQuickPdfPageImage::load(): fall back to base class impl to avoid crash Plain Image is ok for loading one PDF page at a time, except that the pdf plugin has to create its own PDF document object if it cannot reuse an instance that is already open. So PdfPageImage was created just as an optimization, with the expectation that the document will be given to the document property. But in case someone doesn't understand and tries to set only the inherited Image.source property instead, fall back to QQuickImageBase::load() to avoid crashing. Amends 7b8832ca2b84d549c9d374550c3c46b3d4d42a38 If both the document and source properties are set, prefer the document (for the sake of performance). Add test coverage of other combinations of properties, while we're at it. Pick-to: 6.5 6.6 6.7 Fixes: QTBUG-104767 Task-number: QTBUG-77506 Change-Id: I1ee0d0bb2a6c5f399234ddddd969be02e7a6c020 Reviewed-by: Axel Spoerl --- .../pdfpageimage/data/bookmarksAndLinks.pdf | 317 +++++++++++++++++++++ 1 file changed, 317 insertions(+) create mode 100644 tests/auto/pdfquick/pdfpageimage/data/bookmarksAndLinks.pdf (limited to 'tests/auto/pdfquick/pdfpageimage/data/bookmarksAndLinks.pdf') diff --git a/tests/auto/pdfquick/pdfpageimage/data/bookmarksAndLinks.pdf b/tests/auto/pdfquick/pdfpageimage/data/bookmarksAndLinks.pdf new file mode 100644 index 000000000..aa0b99039 --- /dev/null +++ b/tests/auto/pdfquick/pdfpageimage/data/bookmarksAndLinks.pdf @@ -0,0 +1,317 @@ +%PDF-1.7 + +1 0 obj +<< + /Type /Catalog + /PageMode /FullScreen + /Outlines 6 0 R + /Pages 2 0 R + /Names 50 0 R + /PageLabels 23 0 R + /ViewerPreferences<> +>> +endobj + +50 0 obj +<< + /Dests <> +>> +endobj + +23 0 obj +<< + /Nums [0 <> 3 <> 4<> 5<> ] + /Limits [0 5] +>> +endobj + +2 0 obj +<< + /Type /Pages + /Kids [3 0 R 4 0 R 5 0 R] + /Count 3 +>> +endobj + +3 0 obj +<< + /Type /Page + /Parent 2 0 R + /MediaBox [0 10 600 800] + /Annots [24 0 R 25 0 R] + /Contents 16 0 R + /Resources << + /Font <> + >> +>> +endobj + +24 0 obj +<< + /Subtype /Link + /Border [0 0 0] + /Dest (ToTest2) + /A << /Type /Action + /S /GoTo + /D [5 0 R /FitR ¨C4 399 199 533] + >> + /Rect [10 690 150 720] + +>> +endobj + +25 0 obj +<< + /Subtype /Link + /Border [0 0 0] + /Dest (ToTest3) + /Rect [10 630 150 650] +>> +endobj + + +16 0 obj +<< /Length 0 >> + stream + BT + /F1 72 Tf + 200 200 TD + 0 0 1 RG + 5 Tr + (Test_1) Tj + 0 800 m + 600 0 l S + /F1 30 Tf + 0 1 0 RG + 1 Tr + -190 490 TD + (GO Test_2) Tj + 0 -50 TD + 5 w + 2 Tr + 1 0 0 RG + (GO Test_3) Tj + ET + endstream +endobj + + +endobj + +18 0 obj +<< + /Type /Font + /Subtype /Type1 + /Name /F1 + /BaseFont /Helvetica +>> +endobj + +4 0 obj +<< + /Type /Page + /Parent 2 0 R + /MediaBox [10 0 500 700] + /Annots [60 0 R] + /Contents 19 0 R + /Resources << + /Font <> + >> +>> +endobj + +19 0 obj +<< /Length 0 >> +stream +BT + 1 -0.7 0 1 30 100 cm + /F2 50 Tf + 10 50 TD + (TEST_2) Tj + + 1 0.7 0 1 -30 -100 cm + /F2 25 Tf + 1 0 1 RG + 7 w + 100 60 TD + + (GO Test_1) Tj + 100 100 140 40 re S f +ET +endstream +endobj + +20 0 obj +<< + /Type /Font + /Subtype /TrueType + /Name /F2 + /BaseFont /NewYork , Bold + /FirstChar 0 + /LastChar 255 + /Widths 23 0 R + /FontDescriptor 7 0 R + /Encoding /MacRomanEncoding +>> +endobj + +60 0 obj +<< + /Subtype /Link + /Border [0 0 0] + /Dest (ToTest1) + /Rect [110 110 230 150] +>> +endobj + +5 0 obj +<< + /Type /Page + /Parent 2 0 R + /MediaBox [-10 -10 400 600] + /Annots [61 0 R] + /Contents 21 0 R + /Resources << /Font <> >> +>> +endobj + +21 0 obj +<< /Length 0 >> +stream +BT + /F3 30 Tf + 290 10 TD + (TEST_3) Tj + -50 90 TD + (GO Test_2)Tj +ET +endstream +endobj + +22 0 obj +<< + /Type /Font + /Subtype /Type1 + /Name /F3 + /BaseFont /Courier-Bold +>> +endobj + +61 0 obj +<< + /Subtype /Link + /Border [0 0 0] + /Dest (ToTest2) + /Rect [240 90 400 130] +>> + +6 0 obj +<< + /Type /Outlines + /First 7 0 R + /Last 11 0 R + /Count 4 0 R +>> +endobj + +7 0 obj +<< + /Title (First) + /Parent 6 0 R + /Next 8 0 R + /C [1 0 0] + /Dest [ 3 0 R /XYZ 600 800 0.5 ] +>> +endobj + +8 0 obj +<< + /Title (Second) + /Parent 6 0 R + /Prev 7 0 R + /Next 9 0 R + /C [0 1 0] + % /Dest [ 4 0 R /XYZ 500 700 null ] +/Dest (ToTest2) +>> +endobj + +9 0 obj +<< + /Title (Third) + /Parent 6 0 R + /Prev 8 0 R + /Next 10 0 R + /C [0 0 1] + /Dest [ 5 0 R /XYZ 400 600 0.8 ] +>> +endobj + +10 0 obj +<< + /Title (Fourth) + /Parent 6 0 R + /Prev 9 0 R + /Next 11 0 R +>> +endobj + +11 0 obj +<< + /Title (Fivth) + /Parent 6 0 R + /Prev 10 0 R + /First 12 0 R + /Last 15 0 R + /Count 4 +>> +endobj + +12 0 obj +<< + /Title (Fivth_1) + /Parent 11 0 R + /Next 13 0 R +>> +endobj + +13 0 obj +<< + /Title (Fivth_2) + /Parent 11 0 R + /Prev 12 0 R + /Next 14 0 R +>> +endobj + +14 0 obj +<< + /Title (Fivth_3) + /Parent 11 0 R + /Prev 13 0 R + /Next 15 0 R +>> +endobj + +15 0 obj +<< + /Title (Fivth_4) + /Parent 11 0 R + /Prev 14 0 R +>> +endobj + + + + +xref +0000000000 65536 f + +trailer +<< + /Size 0 + /Root 1 0 R +>> +startxref +0 +%%EOF -- cgit v1.2.3