Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Get total Pages of PDF File with Ghostscript?

FiestaK
2006-10-26
2013-03-22
  • FiestaK
    FiestaK
    2006-10-26

    When GSview runs a PDF File, it shows the total page count. I searched in the documentation of Ghostscript but could not found anything how to get the count via api or else. Need your help!

     
    • Nigel Hathaway
      Nigel Hathaway
      2006-10-27

      You are probably best off looking at the PDF spec. As far as I remember there's a data structure in the PDF file that gives you this.

       
    • FiestaK
      FiestaK
      2006-10-30

      I tried different ways to get the page count from the pdf file directly, but its not reliably. I looked in the PDF spec how to get it but i was not succesful.

       
      • Nigel Hathaway
        Nigel Hathaway
        2006-10-30

        Have you tried looking at the source code for GsView?