]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
gstoraster, foomatic-rip: gs command line for counting pages takes too long
authorTill Kamppeter <till.kamppeter@gmail.com>
Tue, 15 Jun 2021 18:50:02 +0000 (20:50 +0200)
committerTill Kamppeter <till.kamppeter@gmail.com>
Tue, 15 Jun 2021 18:50:02 +0000 (20:50 +0200)
NEWS
filter/foomatic-rip/postscript.c
filter/gstoraster.c

diff --git a/NEWS b/NEWS
index b0a87143c4d6b6b0b9b697e858b2a3c57468fcb5..433061fcd074fb2995da243892fde96df91c8fbf 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,10 @@ NEWS - OpenPrinting CUPS Filters v1.28.8 - 2021-03-25
 
 CHANGES IN V1.28.9
 
+       - gstoraster, foomatic-rip: Fixed Ghostscript command line for
+         counting pages as it took too long on PDFs from evince when
+         printing DjVu files (Issue #354, Pull request #371, Ubuntu
+         bug #1920730).
        - cups-browsed: Renamed ldap_connect() due to conflict in
          new openldap (Issue #367, Pull request #370).
        - pdftoraster: Free color data after processing of each page
index bcff56aa36d8d79a0fcd12d58dc7bcad13407d1e..f68860cc781310ee9ec41cbaf0bf783be563e3b4 100644 (file)
@@ -174,7 +174,10 @@ int ps_pages(const char *filename)
     char output[31] = "";
     int pagecount;
     size_t bytes;
-    snprintf(gscommand, 65536, "%s -q -dNOPAUSE -dBATCH -sDEVICE=bbox %s 2>&1 | grep -c HiResBoundingBox",
+    /* Ghostscript runs too long while printing PDF fikes converted from
+       djvu files. Using -dDEVICEWIDTHPOINTS=1 -dDEVICEHEIGHTPOINTS=1
+       solves the problem */
+    snprintf(gscommand, 65536, "%s -q -dNOPAUSE -dBATCH -sDEVICE=bbox -dDEVICEWIDTHPOINTS=1 -dDEVICEHEIGHTPOINTS=1 %s 2>&1 | grep -c HiResBoundingBox",
               CUPS_GHOSTSCRIPT, filename);
     FILE *pd = popen(gscommand, "r");
     bytes = fread(output, 1, 31, pd);
index e0ef2a0dd342ee76264f2bb870b9fd094832633a..1669603e5435d02dbeba6bc01b7394d7c7e2a4eb 100644 (file)
@@ -733,7 +733,10 @@ main (int argc, char **argv, char *envp[])
     char output[31] = "";
     int pagecount;
     size_t bytes;
-    snprintf(gscommand, 65536, "%s -q -dNOPAUSE -dBATCH -sDEVICE=bbox %s 2>&1 | grep -c HiResBoundingBox",
+    /* Ghostscript runs too long while printing PDF fikes converted from
+       djvu files. Using -dDEVICEWIDTHPOINTS=1 -dDEVICEHEIGHTPOINTS=1
+       solves the problem */
+    snprintf(gscommand, 65536, "%s -q -dNOPAUSE -dBATCH -sDEVICE=bbox -dDEVICEWIDTHPOINTS=1 -dDEVICEHEIGHTPOINTS=1 %s 2>&1 | grep -c HiResBoundingBox",
             CUPS_GHOSTSCRIPT, filename);
 
     FILE *pd = popen(gscommand, "r");