diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index 761ca05ae..a49073cd4 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -728,3 +728,4 @@
!issue19517.pdf
!empty#hash.pdf
!bug1885505.pdf
+!bug1974436.pdf
diff --git a/test/pdfs/bug1974436.pdf b/test/pdfs/bug1974436.pdf
new file mode 100755
index 000000000..e401f7057
--- /dev/null
+++ b/test/pdfs/bug1974436.pdf
@@ -0,0 +1,462 @@
+%PDF-1.6
+%
+1 0 obj
+<< /Lang (en) /MarkInfo << /Marked true /Type /MarkInfo >> /Metadata 3 0 R /Pages 6 0 R /StructTreeRoot 8 0 R /Type /Catalog /ViewerPreferences << /DisplayDocTitle true /Type /ViewerPreferences >> >>
+endobj
+2 0 obj
+<< /CreationDate (D:20250625114924Z) /Creator (Mozilla/5.0 \(Windows NT 10.0; Win64; x64\) AppleWebKit/537.36 \(KHTML, like Gecko\) Chrome/138.0.0.0 Safari/537.36) /ModDate (D:20250627152217+02'00') /Producer (Skia/PDF m138) /Title (test.html) >>
+endobj
+3 0 obj
+<< /Subtype /XML /Type /Metadata /Length 3394 >>
+stream
+
+
+
+
+ 2025-06-25T11:49:24Z
+ Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
+ 2025-06-27T15:22:17+02:00
+ 2025-06-27T15:22:17+02:00
+ Skia/PDF m138
+ application/pdf
+
+
+ test.html
+
+
+ uuid:0d6dd1b4-8ed2-4c65-9915-1ddfd0a22bbb
+ uuid:2242d02e-ccea-46e7-a15d-78764a82a089
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+endstream
+endobj
+4 0 obj
+<< /Type /ObjStm /Length 277 /N 2 /First 10 >>
+stream
+5 0 6 223
+<< /Annots 14 0 R /Contents 17 0 R /MediaBox [ 0 0 594.95996 841.91998 ] /Parent 6 0 R /Resources << /ExtGState << /GS0 18 0 R >> /Font << /C2_0 20 0 R >> /ProcSet [ /PDF /Text ] >> /StructParents 0 /Tabs /S /Type /Page >>
+<< /Count 1 /Kids [ 5 0 R ] /Type /Pages >>
+endstream
+endobj
+7 0 obj
+<< /Type /ObjStm /Length 342 /N 5 /First 30 >>
+stream
+8 0 9 77 10 144 11 195 12 271
+<< /K 9 0 R /ParentTree 23 0 R /ParentTreeNextKey 4 /Type /StructTreeRoot >>
+<< /K 10 0 R /Lang (en) /P 8 0 R /S /Document /Type /StructElem >>
+<< /K 11 0 R /P 9 0 R /S /Div /Type /StructElem >>
+<< /K [ 2 5 12 0 R ] /P 10 0 R /Pg 5 0 R /S /NonStruct /Type /StructElem >>
+<< /K 7 /P 11 0 R /Pg 5 0 R /S /Annot >>
+endstream
+endobj
+13 0 obj
+<< /Type /ObjStm /Length 593 /N 3 /First 18 >>
+stream
+14 0 15 18 16 471
+[ 15 0 R 16 0 R ]
+<< /A<< /S /URI /URI (https://www.mozilla.org) >> /C [ 1.0 0.384308 0.0 ] /CA 0.399994 /CreationDate (D:20250627152215+02'00') /F 4 /M (D:20250627152215+02'00') /NM (39567f09-a249-4ed1-ad00-9deaf58e77ae) /P 5 0 R /QuadPoints [ 363.031 809.4 552.008 809.4 363.031 793.236 552.008 793.236 34.4997 795.9 74.4899 795.9 34.4997 779.736 74.4899 779.736 ] /Rect [ 33.9946 779.231 552.513 809.905 ] /Subtype /Link /T (Calixte Denizet) /Type /Annot >>
+<< /F 28 /Open false /Parent 15 0 R /Rect [ 594.96 717.4 778.96 809.4 ] /Subtype /Popup /Type /Annot >>
+endstream
+endobj
+17 0 obj
+<< /Length 782 >>
+stream
+/NonStruct <>BDC
+q
+0.24 0 0 -0.24 0 841.91998 cm
+118.75 118.75 2244.043 3272.07 re
+W* n
+4.1666667 0 0 -4.1666667 0 3507.9999167 cm
+BT
+0 0 0 rg
+/GS0 gs
+/C2_0 16 Tf
+0.75 0 0 0.75 34.5 796.92 Tm
+[<002B0048005500480003004C005600030044000300380035002F>37.4 <000300440056000300570048005B0057001D00030042004200420042004200420042004200420042004200420042004200420042004200420042004200420042004200420042004200420042004200420042004200420042004200420003>]TJ
+ET
+EMC
+BT
+/NonStruct <>BDC
+0.75 0 0 0.75 363.0312 796.92 Tm
+<004B0057005700530056001D00120012004A004C0057004B00580045001100460052005000120053005C0053004C0012004F004C00510048004B00440058004F00100046004F0052005800470010>Tj
+EMC
+/Annot <>BDC
+-438.042 -18 Td
+<00490058005100460057004C00520051>Tj
+EMC
+ET
+Q
+endstream
+endobj
+18 0 obj
+<< /BM /Normal /ca 1 >>
+endobj
+19 0 obj
+<< /Type /ObjStm /Length 143 /N 1 /First 5 >>
+stream
+20 0
+<< /BaseFont /AAAAAA+TimesNewRomanPSMT /DescendantFonts [ 25 0 R ] /Encoding /Identity-H /Subtype /Type0 /ToUnicode 26 0 R /Type /Font >>
+endstream
+endobj
+21 0 obj
+<< /Type /ObjStm /Length 104 /N 2 /First 11 >>
+stream
+22 0 23 50
+[ null null 11 0 R null null 11 0 R null 12 0 R ]
+<< /Nums [ 0 22 0 R ] /Type /ParentTree >>
+endstream
+endobj
+24 0 obj
+<< /BBox [ 0.0 0.0 518.518 30.6741 ] /FormType 1 /Matrix [ 1.0 0.0 0.0 1.0 0.0 0.0 ] /Resources << /ExtGState << /R0 << /AIS false /CA 0.399994 /Type /ExtGState /ca 0.399994 >> /R1 << /AIS false /BM /Multiply /Type /ExtGState >> >> /ProcSet [ /PDF ] /XObject << /MWFOForm 27 0 R >> >> /Subtype /Form /Type /XObject /Length 27 >>
+stream
+/R0 gs
+/R1 gs
+/MWFOForm Do
+endstream
+endobj
+25 0 obj
+<< /BaseFont /AAAAAA+TimesNewRomanPSMT /CIDSystemInfo << /Ordering (Identity) /Registry (Adobe) /Supplement 0 >> /CIDToGIDMap /Identity /DW 500 /FontDescriptor 28 0 R /Subtype /CIDFontType2 /Type /Font /W [ 0 [ 777.83203 0 0 250 ] 16 [ 333.00781 250 ] 18 29 277.83203 43 [ 722.16797 0 0 0 610.83984 ] 53 [ 666.99219 0 0 722.16797 ] 68 [ 443.84766 ] 70 [ 443.84766 ] 72 [ 443.84766 333.00781 ] 76 79 277.83203 80 [ 777.83203 ] 85 [ 333.00781 389.16016 277.83203 ] ] >>
+endobj
+26 0 obj
+<< /Length 553 >>
+stream
+/CIDInit /ProcSet findresource begin
+12 dict begin
+begincmap
+/CIDSystemInfo
+<< /Registry (Adobe)
+/Ordering (UCS)
+/Supplement 0
+>> def
+/CMapName /Adobe-Identity-UCS def
+/CMapType 2 def
+1 begincodespacerange
+<0000>
+endcodespacerange
+7 beginbfchar
+<0003> <0020>
+<001D> <003A>
+<002B> <0048>
+<002F> <004C>
+<0035> <0052>
+<0038> <0055>
+<0042> <005F>
+endbfchar
+5 beginbfrange
+<0010> <0012> <002D>
+<0044> <004C> <0061>
+<004F> <0053> <006C>
+<0055> <0058> <0072>
+<005B> <005C> <0078>
+endbfrange
+endcmap
+CMapName currentdict /CMap defineresource pop
+end
+endendstream
+endobj
+27 0 obj
+<< /BBox [ 0.0 0.0 518.518 30.6741 ] /FormType 1 /Group << /S /Transparency >> /Matrix [ 1.0 0.0 0.0 1.0 0.0 0.0 ] /Resources << /ProcSet [ /PDF ] /XObject << /Form 29 0 R >> >> /Subtype /Form /Type /XObject /Length 9 >>
+stream
+/Form Do
+endstream
+endobj
+28 0 obj
+<< /Ascent 891.11328 /CapHeight 662.10938 /Descent 216.30859 /Flags 6 /FontBBox [ -568.35938 -306.64063 2045.8984 1039.55078 ] /FontFile2 30 0 R /FontName /AAAAAA+TimesNewRomanPSMT /ItalicAngle 0 /StemV 61.035156 /Type /FontDescriptor >>
+endobj
+29 0 obj
+<< /BBox [ 33.9946 779.231 552.513 809.905 ] /FormType 1 /Matrix [ 1.0 0.0 0.0 1.0 -33.9946 -779.231 ] /Resources << /ProcSet [ /PDF ] >> /Subtype /Form /Type /XObject /Length 181 >>
+stream
+1 0.384308 0 rg
+1.0102 w
+363.0312 793.236 m
+363.0312 809.3998 l
+552.0077 809.3998 l
+552.0077 793.236 l
+f
+34.4997 779.736 m
+34.4997 795.8998 l
+74.4899 795.8998 l
+74.4899 779.736 l
+f
+endstream
+endobj
+30 0 obj
+<< /Length1 39860 /Length 39860 >>
+stream
+ OS/2p' `VDMXN#h ; cmapYq cvt d + fpgmmYS $
+Ygasp ! glyfCy8r M, Nhdmx= headl@ 6hheaMt \ $hmtxo'E p rlocao maxp% nameAa3 6post$ d <