Re: GS 7.05 / PDF & pages count
"Pascal Chapuis" <[email protected]>
| Newsgroups | gmane.comp.printing.ghostscript.bugs |
|---|---|
| Organization | Guest of ProXad - France |
| Message-ID | <[email protected]> |
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" <[email protected]> a écrit dans le message news:
WpF%[email protected]...
> "Pascal Chapuis" <[email protected]> wrote in message
> news:[email protected]...
> > 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).
>
>
>