[pdftex] Forward looking object references

Hans Hagen pragma at wxs.nl
Tue Mar 18 19:21:34 CET 2003


At 07:08 PM 3/18/2003 +0100, you wrote:


>Igor Khomyakov writes:
>
>  > I am trying to create a PDF document  (DVI is not a requirement) that 
> would
>  > show the total number of pages on each page (e.g. PAGE X OF Y), and do 
> it in
>  > one front-to-back linear pdfTeX pass! I believe it can be done in PDF by
>  > using "forward object references" (I also did not think it was possible
>  > until a colleague of mine suggested this interesting method). For example,
>  > the output doc can look as follows:
>  >
>  > page 1: PAGE 1 OF <reference to 1000 0 R>
>  > page 2: PAGE 2 OF <reference to 1000 0 R>
>  > ....
>  > page 100: PAGE 100 OF <reference to 1000 0 R>
>  > 1000 0 obj <<...100...>>
>
>Since the PDF experts seem to have struck out on this,

eh .. wasn't there an answer?

>permit me to observe that this is well within the range of
>DVI technology.  Some standard DVI tools on CTAN notably
>"dvipaste" (by M. Spivak) will let you do this.

pdftex is a one-pass output generator, while dvi has a second stage; this 
means that for this second pass, the number of pages is known which in turn 
means that the backend can resolve symbolic forward page refs (i guess that 
dvipdfmx could somehow handle it if needed).

if one saved the number of pages, then the second pdftex run can handle it 
as well, so, it's more or less related to the number of output passes (two 
times pdftex vs tex->dvi + dvi->pdf). A hack could be to let pdftex flush 
some kind of object ref placeholder, keer track of the positions in the 
file, and afterwards fill in those gaps (direct file access). But, since 
most jobs are multipass anyway, it would not really simplify life.

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma at wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------



More information about the pdftex mailing list