Created #233<https://github.com/podofo/podofo/issues/233>. Sorry for spamming 
the list, Monday morning …


Cheers,
Christopher

The MathWorks GmbH | Friedlandstr.18 | 52064 Aachen | District Court Aachen | 
HRB 8082 | Managing Directors: Bertrand Dissler, Steven D. Barbo, Jeanne O’Keefe




From: Christopher Creutzig <ccreu...@mathworks.com>
Date: Monday, 10. February 2025 at 08:32
To: podofo-users@lists.sourceforge.net <podofo-users@lists.sourceforge.net>
Subject: XRef-only PDF 1.2?
Hello list,

I have come across a PDF that says it is PDF-1.2, but lacks a trailer.


%PDF-1.2
…

74 0 obj

<</ModDate(D:20231021205942-07'00')/Creator(3B2 Total Publishing 
6.03d/W)/CreationDate(D:19990204113552)/Producer(<FE><FF>PDFlib PLOP 2.0.0p6 
\(SunOS\)/Acrobat Distiller 3.02; modified using iText 4.2.0 by 
1T3XT)/Subject(Flavour & Fragrance J 
1999.14:12-14)/WPS-PROCLEVEL(2)/WPS-JOURNALDOI(10.1002/\(ISSN\)1099-1026)/Title(The
 volatile constituents of Stachys athorecalyx C. Koch. from 
Turkey)/WPS-ARTICLEDOI(10.1002/\(SICI\)1099-1026\(199901/02\)14:1<12::AID-FFJ763>3.0.CO;2-7)>>

endobj
…
75 0 obj
<</Info 74 0 R/Filter/FlateDecode/Type/XRef/W[1 3 2]/Index[0 76]/ID 
[<6578d3d85f8c20df99b60668aa8db362><7677d29556fbaf31d0e0f2ab8d162bad>]/Root 37 
0 R/Length 248/Size 76>>stream
x<9C>5<D1>-O<C2>Q^X^E<F0>s<FE><FC>^QQ^P^UQ<F1>]PGg^N<E7><9C><D0>uv<93><B3>^Q<FC>^H<9A><AD>^F77<C6>W<E0>^S<D8>t^D<93>^Af0H1^X<D8>^L^D<83><E1><CA>s<F6>x<C3>og<E7><BE><<E1>^BDt^@D@^L^Pȍeܴ^\_ʎ<9<99><CC><CB>^K?I"<FB>hM<ED>ɛ]<B9>!^S2)<CB>rF<E6><E5><A2>\<96><AB>rJF2<96><B9>񬮿<A<A4><9F>=<A7><88>ҩ<CD>=<<F7>f<92><D8>^?<F0><9C>&<8E>Z<9E>3<C4>q<DF><F3>4<F1>ٲ[_^MsX7<BF>?<CC>ѵ<F9>sg<FE>^<99><A1>鷲rK<CE><C9>Y<A2>^<F1><DD>y<E2>^D<9E>^Kr<81>8ESCz<B3>D<DC>W=<AF><C8>"<F1>R<F4>f]<AE>^Q<AF><B7><DE>l^R<BD><FF>ݒ<DC>&<FA>^Yov<88><B7><B6><E7>=b<F0>n^?^T<DD>@+<84>?͖'^G
endstream
endobj
startxref
69529
%%EOF

If I read the specs correctly, that is technically valid from 1.5 onwards. 
PoDoFo (both 0.9.6 and trunk) happily read the file if I patch the first line 
to claim PDF-1.3.

Is there any reason not to attempt to read the whole thing for PDF < 1.3?

Minimal patch to help our customer would be:

diff --git a/src/podofo/private/PdfParser.cpp b/src/podofo/private/PdfParser.cpp
index f94a325b..e0711547 100644
--- a/src/podofo/private/PdfParser.cpp
+++ b/src/podofo/private/PdfParser.cpp
@@ -348,8 +348,8 @@ void PdfParser::ReadXRefContents(InputStreamDevice& device, 
size_t offset, bool

     if (token != "xref")
     {
-        // Found linearized 1.3-pdf's with trailer-info in xref-stream
-        if (m_PdfVersion < PdfVersion::V1_3)
+        // Found linearized 1.2-pdf's with trailer-info in xref-stream
+        if (m_PdfVersion < PdfVersion::V1_2)
         {
             PODOFO_RAISE_ERROR(PdfErrorCode::InvalidXRef);
         }



Cheers,
Christopher

The MathWorks GmbH | Friedlandstr.18 | 52064 Aachen | District Court Aachen | 
HRB 8082 | Managing Directors: Bertrand Dissler, Steven D. Barbo, Jeanne O’Keefe



_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to