print/foomatic-filters: Patch Ghostscript call to count PDF pages

Before this patch, the Ghostscript call for counting PDF pages used the
obsolete "pdfdict".  Patch to use "runpdfbegin" instead.

For more information, see Arch Linux bug 62251.
https://bugs.archlinux.org/task/62251

Reported by:	Thomas Vaughan <thomas@vaughan.net>
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Joseph Mingrone 2024-03-02 12:00:16 -04:00
parent 7990e83700
commit c9675e7943
No known key found for this signature in database
GPG Key ID: 36A40C83B0D6EF9E
2 changed files with 15 additions and 1 deletions

View File

@ -1,6 +1,6 @@
PORTNAME= foomatic-filters
PORTVERSION= 4.0.17
PORTREVISION= 11
PORTREVISION= 12
CATEGORIES= print
MASTER_SITES= http://www.openprinting.org/download/foomatic/

View File

@ -0,0 +1,14 @@
--- pdf.c.orig 2012-07-02 14:50:46 UTC
+++ pdf.c
@@ -46,9 +46,8 @@ static int pdf_count_pages(const char *filename)
int pagecount;
snprintf(gscommand, 4095, "%s -dNODISPLAY -q -c "
- "'/pdffile (%s) (r) file def pdfdict begin pdffile pdfopen begin "
- "(PageCount: ) print pdfpagecount == flush currentdict pdfclose "
- "end end quit'",
+ "'/pdffile (%s) (r) file runpdfbegin (PageCount: ) print "
+ "pdfpagecount = quit'",
gspath, filename);
FILE *pd = popen(gscommand, "r");