bug-ghostscript
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GS 7.05 / PDF & pages count


From: Pascal Chapuis
Subject: Re: GS 7.05 / PDF & pages count
Date: Thu, 25 Jul 2002 09:46:39 +0200

Here's what i'm doing :

I print on a pseudo printer (postscript compliant) to get a spool file
(.SPL) which one I intercept.

I convert it to PDF with "gsapi_init_with_args" with argv:
ps2pdf -dNOPAUSE -q - -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=Test.PD
F  TEST.SPL

and call "gsapi_run_string" (on PS file) with :
 "statusdict /pagecount known {statusdict begin pagecount 10 string cvs
print end flush} if"

Then a  TStdioFunction output callback function (set in gsapi_set_stdio) is
called with OutputValue (%%Page...).
I parse this OutputValue to find out the greater page number.

Is there a shorter way to do that or is this correct ?

Many thanks for your help.

PS: I can't get the pages number with Pdf page object because it's
unavailable with only "Acrobat Viewer"... The COM object implementation
seems to be in "Acrobat" or "Acrobat Exchange" and I don't want to deploy
extra software with my solution.

Pascal Chapuis.



"Russell Lang" <address@hidden> a écrit dans le message news:
address@hidden
> "Pascal Chapuis" <address@hidden> wrote in message
> news:address@hidden
> > Hi,
> >
> > I'm using GS with delphi to convert PS to PDF with gsapi_init_with_args
> > fonction.
> > I was wondering how to get the pages count with GS 7.05 and if it's
really
> > "realistic".
> >
> > Does PDF GetNumPages is always the same after translating PS to PDF ?
>
> If you have PostScript, the only reliable way to count pages is to
> interpret it. If you have PDF, the number of pages is given in the
> Pages object.  When you convert PS to PDF, the number of
> pages shouldn't change (assuming you told it to convert all pages).
>
>
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]