[XeTeX] pdf_link_obj(): passed invalid object.

Heiko Oberdiek heiko.oberdiek at googlemail.com
Thu Dec 23 00:12:36 CET 2010


On Wed, Dec 22, 2010 at 04:42:30PM +0100, Ulrike Fischer wrote:

> Am Wed, 22 Dec 2010 13:29:16 +0000 schrieb Jérôme Etévé:
> 
> > See doc.tex , flu.pdf (it works) and matrix.pdf (including it breaks).
> > 
> > $ xelatex doc.tex
> > ...
> > <use  "matrix.pdf"  page37> <use  "matrix.pdf"  page37> [38] (./doc.aux)
> > ** WARNING ** Could not find any valid object.
> > ** WARNING ** Could not find a value in dictionary object.
> > ** WARNING ** Didn't find "endobj".
> > ** ERROR ** pdf_link_obj(): passed invalid object.
> 
> I can reproduce the problem with a current miktex. 
> 
> I could process the file by including matrix.pdf with pdflatex in a
> matrix2.pdf and this including this in the main document processed
> by xelatex (I had to use the option --output-driver="xdvipdfmx -V5"
> as pdflatex generated a 1.5.-pdf).
> 
> xelatex itself (with option --no-pdf) worked fine. It was xdvipdfmx
> which complained. So I would at first make a bug report to the
> xdvipdfmx maintainer. 
> 
> (My first suspect would be the object number: The problematic pdf
> start with 0 0 obj, the other (also the new matrix2.pdf) have a
> number different from zero). But I don't know much about pdf. This
> could also be irrelevant.)

Indeed, matrix.pdf is utterly broken.
And your suspicion with object number 0 is correct, the
problem is the crossref table:

The first object number 0 in the xref table is reserved as
start of a linked list with free objects, from the PDF spec.:
| The first entry in the table (object number 0) is always free
| and has a generation number of 65,535; it is the head of
| the linked list of free objects. The last free entry
| (the tail of the linked list) links back to object number 0.
| (In addition, the table may contain other free entries
| that link back to object number 0 and have a generation
| number of 65,535, even though these entries are not in
| the linked list itself.)

The first entry in matrix.pdf is:
  0000000323 00000 n
It should be
  0000000323 65536 f
Rationale:
* Type "f" and the generation part "65536" is a requirement
  of the PDF specification.
* 323 is not a valid file position of a PDF object, but 323 is
  free object.

Also the entry for object number 2 is wrong:
  0000000016 0000 f
* 16 is not a free object, as last entry of the linked list of
  free objects, it must point back to entry 0:
  0000000000 0000 f

The starting "0 0 obj ..." is not a valid PDF object,
the "..." looks like a trailer dictionary. But this part
of the PDF file is not referenced, thus it's just garbage
that is usually ignored.

xdvipdfmx is correct if it does not like the broken PDF file.
If the very first entry of the xref table is already totally wrong,
what else might be broken.

The PDF file says that the producer is:
  www.adlibsoftware.com:EXS3190-Windows 2003:TNG

If this is the producer and you have paid for the software,
than try to get a fixed version or to get your money back.

The file matrix.pdf seems fixable if at least the first entry
of the xref table is fixed:
* Replace "00000 n" by "65536 f" in the line
  "0000000323 00000 n". That already makes xetex/xdvipdfmx
  happy.
* Or run the file through pdftk to generate a fixed pdf file:
    pdftk matrix-broken.pdf cat output matrix-fixed.pdf

Yours sincerely
  Heiko Oberdiek


More information about the XeTeX mailing list