ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* page counter problem
@ 2020-09-30 10:50 Alan Bowen
  2020-09-30 11:37 ` Taco Hoekwater
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Bowen @ 2020-09-30 10:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1054 bytes --]

he page counter does not increase in the first iteration an PDf inclusion
but seems to work properly after that. Have attached a sample file (69K)
that will serve to show the problem—at least, on my machine.

\starttext

\setupexternalfigures[location=default]
\setuplayer[preset=middlebottom, method=overlay]{}

\setcounter[userpage][101]
\noheaderandfooterlines

\getfiguredimensions[HannahBW.pdf]

\dorecurse{\noffigurepages}
   {\vbox to \paperheight
       {\vskip-\dimexpr\headerheight+\headerdistance+\topspace\relax
        \hbox to \hsize
         {\hskip-\backspace
\layeredtext[]
[boffset=3pc]
{\red\userpagenumber}
{\externalfigure[HannahBW.pdf][page=#1]}%
          \hss}%
     \vss}
  }
\dorecurse{\noffigurepages}
   {\vbox to \paperheight
       {\vskip-\dimexpr\headerheight+\headerdistance+\topspace\relax
        \hbox to \hsize
         {\hskip-\backspace
\layeredtext[]
[boffset=3pc]
{\red\userpagenumber}
{\externalfigure[HannahBW.pdf][page=#1]}%
          \hss}%
     \vss}
  }

\stoptext

[-- Attachment #1.2: Type: text/html, Size: 6546 bytes --]

[-- Attachment #2: HannahBW.pdf --]
[-- Type: application/pdf, Size: 59987 bytes --]

[-- Attachment #3: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: page counter problem
  2020-09-30 10:50 page counter problem Alan Bowen
@ 2020-09-30 11:37 ` Taco Hoekwater
  2020-09-30 12:59   ` Alan Bowen
  0 siblings, 1 reply; 3+ messages in thread
From: Taco Hoekwater @ 2020-09-30 11:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Alan,

> On 30 Sep 2020, at 12:50, Alan Bowen <bowenalan03@gmail.com> wrote:
> 
> he page counter does not increase in the first iteration an PDf inclusion but seems to work properly after that. Have attached a sample file (69K) that will serve to show the problem—at least, on my machine.

It is not the iteration itself. Try with another pdf with more than 2 pages and you
will see that it happens in the first page(s).

The problem is that you are not giving ConTeXt a fair chance to update the page number,
because a series of \vbox to \paperheight {}’s cannot cleanly be broken into separate
pages. The solution is to use 

\dorecurse{\noffigurepages}
   {\vbox to \paperheight 
      		{\vskip-\dimexpr\headerheight+\headerdistance+\topspace\relax
      		 \hbox to \hsize
         {\hskip-\backspace
		\layeredtext[]
			[boffset=3pc]		
		{\red\userpagenumber}
		{\externalfigure[HannahBW.pdf][page=#1]}%
          \hss}%
    		\vss}\page
  }

where the extra \page command allows ConTeXt to properly process the page breaks.

Best wishes,
Taco

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: page counter problem
  2020-09-30 11:37 ` Taco Hoekwater
@ 2020-09-30 12:59   ` Alan Bowen
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Bowen @ 2020-09-30 12:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1977 bytes --]

Thank you, Taco, for the fix *and* the helpful explanation.

The file now works (and I can now put this project to bed!)

Alan

On Wed, Sep 30, 2020 at 7:38 AM Taco Hoekwater <taco@elvenkind.com> wrote:

> Hi Alan,
>
> > On 30 Sep 2020, at 12:50, Alan Bowen <bowenalan03@gmail.com> wrote:
> >
> > he page counter does not increase in the first iteration an PDf
> inclusion but seems to work properly after that. Have attached a sample
> file (69K) that will serve to show the problem—at least, on my machine.
>
> It is not the iteration itself. Try with another pdf with more than 2
> pages and you
> will see that it happens in the first page(s).
>
> The problem is that you are not giving ConTeXt a fair chance to update the
> page number,
> because a series of \vbox to \paperheight {}’s cannot cleanly be broken
> into separate
> pages. The solution is to use
>
> \dorecurse{\noffigurepages}
>    {\vbox to \paperheight
>
> {\vskip-\dimexpr\headerheight+\headerdistance+\topspace\relax
>                  \hbox to \hsize
>          {\hskip-\backspace
>                 \layeredtext[]
>                         [boffset=3pc]
>                 {\red\userpagenumber}
>                 {\externalfigure[HannahBW.pdf][page=#1]}%
>           \hss}%
>                 \vss}\page
>   }
>
> where the extra \page command allows ConTeXt to properly process the page
> breaks.
>
> Best wishes,
> Taco
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 3468 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-30 12:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30 10:50 page counter problem Alan Bowen
2020-09-30 11:37 ` Taco Hoekwater
2020-09-30 12:59   ` Alan Bowen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).