[NTG-pdftex] pdfpagebox

Heiko Oberdiek oberdiek at uni-freiburg.de
Fri Sep 16 01:29:25 CEST 2005


On Thu, Sep 15, 2005 at 09:01:07AM -0700, Thanh Han The wrote:

> On Thu, Sep 15, 2005 at 02:57:59PM +0200, Heiko Oberdiek wrote:
> > 
> > On Thu, Sep 15, 2005 at 04:31:18AM -0700, Thanh Han The wrote:
> > 
> > * What is "1" until "4"?
> >   * It is the first until fourth component
> >     of the box retangle, given in the pdf file?
> 
> they are the values as returned by xpdf -- 
> page->{x1, y1, x2, y2}. I don't know whether xpdf does 
> normalize them, but I hope so.

I have found function PageAttrs::readBox() in file Page.cc.
Here the rectangle values are not normalized, they are read
and assigned in order. To make the life for documentation
writers easier, normalization can easily be done:
  x1_new := min(x1, x2);
  x2_new := max(x1, x2);
  y1_new := min(y1, y2);
  y2_new := max(y1, y2);

or in pseudo code:

  input: x1, x2, x3, x4
  output: x1, x2, x3, x4 (normalized)
  local variable: h;

  if (x1 > x2) {
      h  := x2;
      x2 := x1;
      x1 := h;
  }
  if (y1 > y2) {
      h  := y2;
      y2 := y1;
      y1 := h;
  }

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


More information about the ntg-pdftex mailing list