[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34877: Ghostscript: Missing text when converting PDF to PS

From: Ludovic Courtès
Subject: bug#34877: Ghostscript: Missing text when converting PDF to PS
Date: Sun, 14 Apr 2019 16:55:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hi Diego,

Diego Nicola Barbato <address@hidden> skribis:

> When converting certain PDF files to PostScript pdf2ps (from the
> Ghostscript package) will print the following error messages:
>    **** Error reading a content stream. The page may be incomplete.
>                Output may be incorrect.
>    **** Error: File did not complete the page properly and may be damaged.
>                Output may be incorrect.
> The resulting file will be missing some (sometimes all) of the text.

I have spent time investigating this issue, in vain so far.

There’s already one conclusion that can be drawn: pdf2ps succeeds in my
experience with PDFs that do *not* embed fonts (one of the 14 standard
fonts.)  It fails, as in this case, when fonts *are* embedded.

Looking at the strace output, I initially thought our gs was missing its
resource files: they were supposed to be compiled in
(“COMPILE_INITS=1”), but my understanding was that this was only the
case for the statically-linked gs, which we disabled in commit

So I started by passing --disable-compile-inits and then fixing up
ENOENT issues that I could notice in the strace output (patch below),
but that didn’t make any difference.

I’m still not sure how to interpret this error, it’s really not clear to
me what it really means.  Reports like
<https://bugs.ghostscript.com/show_bug.cgi?id=695874> suggest it has to
do with fonts, but it’s not all that clear in this case.

Anyway, it’s also clear that this is the same problem people experience
when printing.

Ideas welcome!


diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm
index 53a9b60fdb..9591dbdb1d 100644
--- a/gnu/packages/ghostscript.scm
+++ b/gnu/packages/ghostscript.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2013 Andreas Enge <address@hidden>
 ;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <address@hidden>
 ;;; Copyright © 2015 Ricardo Wurmus <address@hidden>
-;;; Copyright © 2013, 2015, 2016, 2017 Ludovic Courtès <address@hidden>
+;;; Copyright © 2013, 2015, 2016, 2017, 2019 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2017 Alex Vong <address@hidden>
 ;;; Copyright © 2017, 2018, 2019 Efraim Flashner <address@hidden>
 ;;; Copyright © 2017 Leo Famulari <address@hidden>
@@ -269,6 +269,59 @@ output file formats and printers.")
     (home-page "https://www.ghostscript.com/";)
     (license license:agpl3+)))
+(define-public ghostscript/fixed
+  (package/inherit
+   ghostscript
+   (version (string-append (package-version ghostscript) "-1"))
+   (arguments
+    (substitute-keyword-arguments (package-arguments ghostscript)
+      ((#:configure-flags flags ''())
+       `(append (list "--disable-compile-inits"
+                      (string-append "--with-fontpath="
+                                     (assoc-ref %build-inputs "gs-fonts")
+                                     "/share/fonts/type1/ghostscript"))
+                ,flags))
+      ((#:phases phases '%standard-phases)
+       `(modify-phases ,phases
+          (add-after 'install 'create-cmap-symlink
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out     (assoc-ref outputs "out"))
+                     (init    (car (find-files out "^Init$"
+                                               #:directories? #t)))
+                     (fontdir (string-append out "/share/ghostscript/fonts"))
+                     (fontdir1 (string-append out 
+                (symlink "../CMap"
+                         (string-append init "/CMap"))
+                (symlink "../Init/Fontmap"
+                         (string-append init "/../Font/Fontmap"))
+                (mkdir-p fontdir)
+                (symlink (string-append init "/Fontmap")
+                         (string-append fontdir "/Fontmap"))
+                (mkdir-p fontdir1)
+                (symlink (string-append init "/Fontmap")
+                         (string-append fontdir1 "/Fontmap"))
+                #t)))))))
+   (inputs `(("gs-fonts" ,gs-fonts)
+             ,@(package-inputs ghostscript)))))
+(define-public ghostscript/static
+  ;; Like before commit eb354bdacbf4154ec66038dac07f19bf4ced1fad.
+  (package
+    (inherit ghostscript)
+    (name "ghostscript-static")
+    (arguments
+     (substitute-keyword-arguments (package-arguments ghostscript)
+       ((#:phases phases '%standard-phases)
+        `(modify-phases ,phases
+           (replace 'build
+             (lambda _
+               (invoke "make" "-j5")))
+           (replace 'install
+             (lambda _
+               (invoke "make" "install")))
+           (delete 'create-gs-symlink)))))))
 (define-public ghostscript/x
   (package/inherit ghostscript
     (name (string-append (package-name ghostscript) "-with-x"))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]