Hi,
I'm looking for a way to get the number of pages contained in a PostScript document, so I can use it in a script.
Any suggestions?
Niki
On Mon, Sep 7, 2009 at 3:12 AM, Niki Kovacscontact@kikinovak.net wrote:
Hi,
I'm looking for a way to get the number of pages contained in a PostScript document, so I can use it in a script.
Any suggestions?
One quick and dirty method will be to count the word "showpage' that is not commented out. But this may not give you an accurate number of pages (some aliases might be used).
Akemi
Akemi Yagi a écrit :
One quick and dirty method will be to count the word "showpage' that is not commented out. But this may not give you an accurate number of pages (some aliases might be used).
I found a neat solution, finally. My initial document is a PDF, so here goes:
$ pdfinfo file.pdf | grep Pages | cut -d : -f 2 | tr -d ' '
Cheers,
Niki
At Mon, 7 Sep 2009 04:35:08 -0700 CentOS mailing list centos@centos.org wrote:
On Mon, Sep 7, 2009 at 3:12 AM, Niki Kovacscontact@kikinovak.net wrote:
Hi,
I'm looking for a way to get the number of pages contained in a PostScript document, so I can use it in a script.
Any suggestions?
One quick and dirty method will be to count the word "showpage' that is not commented out. But this may not give you an accurate number of pages (some aliases might be used).
Does this help:
sauron.deepsoft.com% psselect -r <TypemapsEven.ps >/dev/null [9] [8] [7] [6] [5] [4] [3] [2] [1] Wrote 9 pages, 480115 bytes
Or this:
sauron.deepsoft.com% grep '^%%Pages' TypemapsEven.ps %%Pages: (atend) %%Pages: 9
(These methods assume that the PS file has the proper DSC comments.)
Akemi _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On Mon, 07 Sep 2009 12:12:12 +0200 Niki Kovacs wrote:
I'm looking for a way to get the number of pages contained in a PostScript document, so I can use it in a script.
grep %%Page: file.ps | wc -l