all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Diego Nicola Barbato <dnbarbato@posteo.de>
Cc: 34877@debbugs.gnu.org
Subject: bug#34877: Ghostscript: Missing text when converting PDF to PS
Date: Sun, 14 Apr 2019 16:55:22 +0200	[thread overview]
Message-ID: <878swcljqd.fsf@gnu.org> (raw)
In-Reply-To: <87wokzhhgp.fsf@GlaDOS.home> (Diego Nicola Barbato's message of "Fri, 15 Mar 2019 23:59:34 +0100")

[-- Attachment #1: Type: text/plain, Size: 1660 bytes --]

Hi Diego,

Diego Nicola Barbato <dnbarbato@posteo.de> 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
eb354bdacbf4154ec66038dac07f19bf4ced1fad.

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!

Ludo’.


[-- Attachment #2: Type: text/x-patch, Size: 3341 bytes --]

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 <andreas@enge.fr>
 ;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2013, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2015, 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
 ;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
@@ -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 "/share/fonts/type1/ghostscript")))
+                (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"))

  parent reply	other threads:[~2019-04-14 14:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87wokzhhgp.fsf@GlaDOS.home>
2019-03-17 12:05 ` bug#34877: Ghostscript: Missing text when converting PDF to PS Diego Nicola Barbato
2019-03-17 14:51   ` bug#34892: " Diego Nicola Barbato
2019-04-14 14:55 ` Ludovic Courtès [this message]
2019-05-13 10:22 ` bug#34877: #34877 " sirmacik
2019-05-13 14:13 ` bug#34877: sirmacik
2019-08-25 20:53 ` bug#34877: Ghostscript: Missing text when converting PDF to PS Ludovic Courtès
2019-08-29  7:53   ` sirmacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878swcljqd.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=34877@debbugs.gnu.org \
    --cc=dnbarbato@posteo.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.