Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #126

Re: PDF: multiple slides per page to one slide per page?

From ken <ken@spamcop.net>
Newsgroups comp.lang.postscript
Subject Re: PDF: multiple slides per page to one slide per page?
Date 2011-04-23 16:10 +0100
Message-ID <MPG.281cfc403305e78498982f@usenet.plus.net> (permalink)
References <7d554826-c2b6-4dff-a363-8e8bf16c6798@r19g2000prm.googlegroups.com> <MPG.27e30eeb4abd417798981e@usenet.plus.net> <fb141551-05f0-47a3-8ef3-418c2bfc4dce@h9g2000pre.googlegroups.com>

Show all headers | View raw


In article <fb141551-05f0-47a3-8ef3-
418c2bfc4dce@h9g2000pre.googlegroups.com>, dmathog@gmail.com says...

> convert are marked up 4 to a page.  So I made this change (the
> coordinates match my input):
> 
> 1 1 PDFPageCount {
> dup
> % 1 of 4
>         <</PageSize [330 248] /PageOffset [-42 326]>> setpagedevice
>         pdfgetpage
>         dup /Page exch store
>         pdfshowpage_finish
> % 2 of 4
>         <</PageSize [330 248] /PageOffset [-420 326]>> setpagedevice
>         pdfgetpage
>         dup /Page exch store
>         pdfshowpage_finish
> % 3 of 4
>         <</PageSize [330 248] /PageOffset [-42 38]>> setpagedevice
>         pdfgetpage
>         dup /Page exch store
>         pdfshowpage_finish
> % 4 of 4
>         <</PageSize [330 248] /PageOffset [-420 38]>> setpagedevice
>         pdfgetpage
>         dup /Page exch store
>         pdfshowpage_finish
> } for
> 
> And it blows up on the 3rd one.  The odd thing is that any 2 of the
> subpages will work, but if there are 3 (or more) of them it crashes.
> It will crash on the 3rd instance of the same subpage (ie, do 1 of 4
> three times in a row). In the following example the first two
> >>showpage were the successful displays, and what follows is what
> transpired after the second (return):
> 
> GPL Ghostscript 9.02 (2011-03-30)
> Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
> This software comes with NO WARRANTY: see the file PUBLIC for details.
> 
> >>showpage, press <return> to continue<<
> 
> >>showpage, press <return> to continue<<
> 
> Error: /stackunderflow in --index--
> Operand stack:

Silly me, its quite obvious when I think about it.

THe pdf_slice.ps program is intended to deal with 2 pages, and 
pdfgetpage takes the page count from the stack so it knows which page to 
use. So this:

1 1 PDFPageCount {
dup
...
...
} for

takes the current index of the loop counter, which is pushed on the 
stack each time round the loop by the 'for' operator, and copies it. So 
we haev 2 copies of the page index on the stack.

Obviously if we then call pdfgetpage 3 times, we will be short of one 
copy :-)

So if you change 'dup' to 'dup dup dup' (or as many as are required for 
the number of sub pages -1) then ti will work better :-)


			Ken

Back to comp.lang.postscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: PDF: multiple slides per page to one slide per page? David Mathog <dmathog@gmail.com> - 2011-04-22 09:03 -0700
  Re: PDF: multiple slides per page to one slide per page? David Mathog <dmathog@gmail.com> - 2011-04-22 10:41 -0700
    Re: PDF: multiple slides per page to one slide per page? ken <ken@spamcop.net> - 2011-04-22 19:36 +0100
      Re: PDF: multiple slides per page to one slide per page? David Mathog <dmathog@gmail.com> - 2011-04-22 13:01 -0700
        Re: PDF: multiple slides per page to one slide per page? ken <ken@spamcop.net> - 2011-04-22 21:50 +0100
  Re: PDF: multiple slides per page to one slide per page? ken <ken@spamcop.net> - 2011-04-22 19:33 +0100
  Re: PDF: multiple slides per page to one slide per page? ken <ken@spamcop.net> - 2011-04-23 16:10 +0100
    Re: PDF: multiple slides per page to one slide per page? David Mathog <dmathog@gmail.com> - 2011-04-23 08:50 -0700
      Re: PDF: multiple slides per page to one slide per page? ken <ken@spamcop.net> - 2011-04-23 21:29 +0100
        Re: PDF: multiple slides per page to one slide per page? ken <ken@spamcop.net> - 2011-04-25 12:03 +0100
      Re: PDF: multiple slides per page to one slide per page? David Mathog <dmathog@gmail.com> - 2011-04-26 08:40 -0700
        Re: PDF: multiple slides per page to one slide per page? ken <ken@spamcop.net> - 2011-04-26 17:21 +0100
          Re: PDF: multiple slides per page to one slide per page? David Mathog <dmathog@gmail.com> - 2011-04-26 13:23 -0700
            Re: PDF: multiple slides per page to one slide per page? ken <ken@spamcop.net> - 2011-04-27 08:31 +0100

csiph-web