[tex-live] hyperref 6.79n breaks xetex's (xdvipdfmx) ability to set proper page dimensions (and overrides page dimensions on pdftex)

Heiko Oberdiek oberdiek at uni-freiburg.de
Mon Dec 14 11:02:57 CET 2009

On Mon, Dec 14, 2009 at 04:28:33AM +0300, Vladimir Volovich wrote:

> [first is the xetex-related part of bug report, then follows the
> pdftex-related part]
> when using hyperref with unicode option, I'm not able to set the proper
> page dimensions.
> Here is a minimal working example which demonstrates the problem:
> \documentclass{article}
> \usepackage[unicode,pdftitle={test}]{hyperref}
> \pdfpagewidth=300bp
> \pdfpageheight=300bp
> \begin{document}

\paperwidth and \paperheight are in size *letter* (default of
class article); hyperref looks at these registers using \AtBeginDocument.


The setting of the paper/media size is independent from option `unicode'.

> when running "xelatex test.tex", i see the following few last lines on
> terminal:
> [1] (./test.aux)
> ** WARNING ** Failed to convert input string to UTF16...

> (the WARNING is actually produced by xdvipdfmx, rather than by xetex itself;

hyperref uses the same specials as for dvipdfm. The only exception is
the current version of today. It will use pdfTeX's \pdfpagewidth
and \pdfpageheight for setting the paper/media size.

Unhappily there isn't any documentation/specification, what is
different to dvipdfm. At least hyperref should now generate
correct PDF strings in UTF-16, for outlines, info entries,
page labels.

> the \pdfpagewidth and \pdfpageheight primitives are working in xetex,
> and i used them rather than the geometry package to make an example
> simpler to debug.)
> when i then run "pdfinfo test.pdf", i get:
> $ pdfinfo test.pdf 
> Page size:      612 x 792 pts (letter)

> Notice that the page size is wrong.

No, LaTeX thinks different: \showthe\paperwidth and
\showthe\paperheight give:
  614.295pt and 794.96999pt
that is
  612bp and 792bp (letter format)

> If i comment out the line which calls the hyperref package, i get no
> warning, and the pdfinfo shows the expected page size:
> $ pdfinfo test.pdf 
> Page size:      300 x 300 pts

But LaTeX allows you to fill a complete letter page.

Correct is setting the paper size in LaTeX *and*
setting it for the output media or let a package do the last or
both parts (geometry, hyperref, ...).

It's a deficiency of LaTeX that the second part is necessary.

> is this a bug in hyperref (e.g. it produces some malformed UTF16 string
> which xdvipdfmx can't handle) or in xdvipdfmx?

* Media size: the bug is in the incomplete user input (forgetting
  about \paperwidth, \paperheight.

* UTF16-warning: AFAIK the hyperref code is correct in producing
  correct PDF strings in UTF16. I do not have information about
  xdvipdfmx, whether it uses different specials, expects the data
  in different form, ...

> Now, the pdftex-related part of the bug report.
> If I uncomment the "\showthe\pdfpagewidth" line, i see that the
> \pdfpagewidth gets reset after the \begin{document}:
> pdflatex shows:
> > 614.295pt.
> if i comment out hyperref usage, i get the expected result:
> > 301.125pt.

Already explained, see above.

> in xetex, I'm always getting the 301.125pt result, regardless of
> presence of hyperref; but nevertheless because of the WARNING by
> xdvipdfmx, the page dimensions appear wrong when using hyperref.

No, I think, the warning is unrelated to the page size.
It is rather caused by other strings, like entries in the
information dictionary, ...

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>

More information about the tex-live mailing list