[bug-gs] possible bug, use of indirect objects in .pdf
Lobinger Andreas ICM MP P TI 6
andreas.lobinger@siemens.com
Fri, 29 Aug 2003 13:39:45 +0200
Hello,
i'm currently experimenting with .pdfs and and of course i'm testing
my generated files with gs also. Recently a came across the following
behaviour of gs which is different to acroread.
I have two versions of the smallest possible .pdf. No page descriptions,
only root, single object page tree and a page object containing a
MediaBox only.
lobingera@athene: more exp1.pdf
%PDF-1.3
1 0 obj
<< /Type /Catalog
/Pages 2 0 R
>>
endobj
2 0 obj
<< /Type /Pages
/Kids [3 0 R]
/Count 1
>>
endobj
3 0 obj
<< /Type /Page
/Parent 2 0 R
/MediaBox [0 0 200 150]
>>
endobj
4 0 obj
200
endobj
xref
0 5
0000000000 65535 f
0000000009 00000 n
0000000065 00000 n
0000000132 00000 n
0000000214 00000 n
trailer <<
/Size 5
/Root 1 0 R >>
startxref
233
%%EOF
lobingera@athene: more exp2.pdf
%PDF-1.3
1 0 obj
<< /Type /Catalog
/Pages 2 0 R
>>
endobj
2 0 obj
<< /Type /Pages
/Kids [3 0 R]
/Count 1
>>
endobj
3 0 obj
<< /Type /Page
/Parent 2 0 R
/MediaBox [0 0 4 0 R 150]
>>
endobj
4 0 obj
200
endobj
xref
0 5
0000000000 65535 f
0000000009 00000 n
0000000065 00000 n
0000000132 00000 n
0000000216 00000 n
trailer <<
/Size 5
/Root 1 0 R >>
startxref
235
%%EOF
lobingera@athene: gs exp1.pdf
AFPL Ghostscript 8.00 (2002-11-21)
Copyright (C) 2002 artofcode LLC, Benicia, CA. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
>>showpage, press <return> to continue<<
GS>quit
lobingera@athene: gs exp2.pdf .pdf
AFPL Ghostscript 8.00 (2002-11-21)
Copyright (C) 2002 artofcode LLC, Benicia, CA. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Error: /typecheck in --sub--
Operand stack:
--dict:3/3(L)-- --dict:46/46(ro)(L)-- 0 0 150 --nostringval--
0
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval--
--nostringval-- 2 %stopped_push --nostringval-- --nostringval--
--nostringval-- false 1 %stopped_push 1 3 %oparray_pop 1 3
%oparray_pop 1 3 %oparray_pop --nostringval-- 2 1 1
--nostringval-- %for_pos_int_continue --nostringval-- --nostringval--
--nostringval-- --nostringval-- --nostringval-- --nostringval--
Dictionary stack:
--dict:1043/1123(ro)(G)-- --dict:0/20(G)-- --dict:79/200(L)--
--dict:79/200(L)-- --dict:100/127(ro)(G)-- --dict:230/230(ro)(G)--
--dict:19/24(L)-- --dict:2/5(L)--
Current allocation mode is local
AFPL Ghostscript 8.00: Unrecoverable error, exit code 1
exp2.pdf differs from exp1.pdf only in one point. The MediaBox contains a
indirect reference: [0 0 200 150] vs [0 0 4 0 R 150]. The acrobat Reader
does read both files without any warnings/errors.
The PDRRef14 says:
- The MediaBox must be a Rectangle (p88, table 3.19, Entries in a page
object)
- A Rectangle is a array of four numbers (p101, section 3.8.3 Rectangles)
AND:
- Any object in a PDF ?le may be labeled as an indirect object. (p39,
section 3.2.9
Indirect objects).
I'm not aware of any tool that uses indirect references in Rectangles when
producing .pdfs. But i didn't find any objections about not doing it in the
spec. The acrobat Reader does read and display both versions and also
even more complicated documents. So what do do?
If you want to test it by yourself, you should be able to copy the text of
exp[12].pdf out from this email, save it to a file and use it, AS LONG
as you make sure that the EOL marker is single char only.
Hoping for an answer and whishing a happy day
LOBI