From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#34877: Ghostscript: Missing text when converting PDF to PS Date: Sun, 14 Apr 2019 16:55:22 +0200 Message-ID: <878swcljqd.fsf@gnu.org> References: <87wokzhhgp.fsf@GlaDOS.home> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:50048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFgY8-00040I-An for bug-guix@gnu.org; Sun, 14 Apr 2019 10:56:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hFgY6-0007Oh-QP for bug-guix@gnu.org; Sun, 14 Apr 2019 10:56:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:47618) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hFgY6-0007Od-Lx for bug-guix@gnu.org; Sun, 14 Apr 2019 10:56:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hFgY6-0004JV-Fu for bug-guix@gnu.org; Sun, 14 Apr 2019 10:56:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87wokzhhgp.fsf@GlaDOS.home> (Diego Nicola Barbato's message of "Fri, 15 Mar 2019 23:59:34 +0100") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Diego Nicola Barbato Cc: 34877@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Diego, Diego Nicola Barbato 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=E2=80=99s already one conclusion that can be drawn: pdf2ps succeeds i= n 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 (=E2=80=9CCOMPILE_INITS=3D1=E2=80=9D), but my understanding was that this w= as 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=E2=80=99t make any difference. I=E2=80=99m still not sure how to interpret this error, it=E2=80=99s really= not clear to me what it really means. Reports like suggest it has to do with fonts, but it=E2=80=99s not all that clear in this case. Anyway, it=E2=80=99s also clear that this is the same problem people experi= ence when printing. Ideas welcome! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 =C2=A9 2013 Andreas Enge ;;; Copyright =C2=A9 2014, 2015, 2016, 2017 Mark H Weaver ;;; Copyright =C2=A9 2015 Ricardo Wurmus -;;; Copyright =C2=A9 2013, 2015, 2016, 2017 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2013, 2015, 2016, 2017, 2019 Ludovic Court=C3=A8s ;;; Copyright =C2=A9 2017 Alex Vong ;;; Copyright =C2=A9 2017, 2018, 2019 Efraim Flashner ;;; Copyright =C2=A9 2017 Leo Famulari @@ -269,6 +269,59 @@ output file formats and printers.") (home-page "https://www.ghostscript.com/") (license license:agpl3+))) =20 +(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=3D" + (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/ghos= tscript"))) + (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")) --=-=-=--