unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34877: Ghostscript: Missing text when converting PDF to PS
       [not found] <87wokzhhgp.fsf@GlaDOS.home>
@ 2019-03-17 12:05 ` Diego Nicola Barbato
  2019-03-17 14:51   ` bug#34892: " Diego Nicola Barbato
  2019-04-14 14:55 ` bug#34877: " Ludovic Courtès
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Diego Nicola Barbato @ 2019-03-17 12:05 UTC (permalink / raw)
  To: 34877

Hello Guix,

Diego Nicola Barbato <dnbarbato@posteo.de> writes:

> Hello Guix,
>
> When converting certain PDF files to PostScript pdf2ps (from the
> Ghostscript package) will print the following error messages:
>
> --8<---------------cut here---------------start------------->8---
>    **** 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.
> --8<---------------cut here---------------end--------------->8---
>
> The resulting file will be missing some (sometimes all) of the text.
>
> I have attached one such PDF, which I obtained from
> https://www.ichkoche.at/?ctl=recipe_pdf&recipe_id=3161, alongside the
> files generated by running pdf2ps on both Guix System and, for
> reference, Debian 9, where the conversion succeeds (even though they
> provide the same version (9.26 (2018-11-20)) of Ghostscript).
>
> I have also attached the results of running ‘gsnd -dPDFDEBUG’ on the
> offending file.
>
> I run Guix System (commit: 0bd1498) on x86_64.
>
> Regards,
>
> Diego

Unfortunately the original message did not make it to the mailing list
because the attachments were too big.  It did make it to debbugs,
though, so the attachments should be available there
(https://debbugs.gnu.org/34877).

Regards,

Diego

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#34892: Ghostscript: Missing text when converting PDF to PS
  2019-03-17 12:05 ` bug#34877: Ghostscript: Missing text when converting PDF to PS Diego Nicola Barbato
@ 2019-03-17 14:51   ` Diego Nicola Barbato
  0 siblings, 0 replies; 7+ messages in thread
From: Diego Nicola Barbato @ 2019-03-17 14:51 UTC (permalink / raw)
  To: 34892-done

Hello Guix,

I am closing this as it is a duplicate of bug 34877, which I
accidentally submitted twice.

Regards,

Diego

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#34877: Ghostscript: Missing text when converting PDF to PS
       [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-04-14 14:55 ` Ludovic Courtès
  2019-05-13 10:22 ` bug#34877: #34877 " sirmacik
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2019-04-14 14:55 UTC (permalink / raw)
  To: Diego Nicola Barbato; +Cc: 34877

[-- 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"))

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#34877: #34877 Ghostscript: Missing text when converting PDF to PS
       [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-04-14 14:55 ` bug#34877: " Ludovic Courtès
@ 2019-05-13 10:22 ` 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
  4 siblings, 0 replies; 7+ messages in thread
From: sirmacik @ 2019-05-13 10:22 UTC (permalink / raw)
  To: 34877

Hey Guix!

Unfortunately this is something that affects also printing from
pdfs. At this point I can see what my printing result will look like
by opening it in GNU Emacs DocView.

Maybe another way would be to package ghostscript the way Arch does?
It's gs gave me the best quality results I've had on any distro.
Main differences:
- no patches
- more libraries are provided from the system than currently in Guix.

Reference:
https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/ghostscript
https://www.archlinux.org/packages/extra/x86_64/ghostscript/

Unfortunately so far I haven't had the time to modify package in such
manner, but I'd be glad to do any testing necessary for this bug to be
fixed as it is the only blocker of my daily usage of GNU Guix System.

--
sirmacik
PGP: 0xE0DC81D523891771

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#34877:
       [not found] <87wokzhhgp.fsf@GlaDOS.home>
                   ` (2 preceding siblings ...)
  2019-05-13 10:22 ` bug#34877: #34877 " sirmacik
@ 2019-05-13 14:13 ` sirmacik
  2019-08-25 20:53 ` bug#34877: Ghostscript: Missing text when converting PDF to PS Ludovic Courtès
  4 siblings, 0 replies; 7+ messages in thread
From: sirmacik @ 2019-05-13 14:13 UTC (permalink / raw)
  To: 34877

Hey Guix!

Unfortunately this is something that affects also printing from
pdfs. At this point I can see what my printing result will look like
by opening it in GNU Emacs DocView.

Maybe another way would be to package ghostscript the way Arch does?
It's gs gave me the best quality results I've had on any distro.
Main differences:
- no patches
- more libraries are provided from the system than currently in Guix.

Reference:
https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/ghostscript
https://www.archlinux.org/packages/extra/x86_64/ghostscript/

Unfortunately so far I haven't had the time to modify package in such
manner, but I'd be glad to do any testing necessary for this bug to be
fixed as it is the only blocker of my daily usage of GNU Guix System.

--
sirmacik
PGP: 0xE0DC81D523891771

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#34877: Ghostscript: Missing text when converting PDF to PS
       [not found] <87wokzhhgp.fsf@GlaDOS.home>
                   ` (3 preceding siblings ...)
  2019-05-13 14:13 ` bug#34877: sirmacik
@ 2019-08-25 20:53 ` Ludovic Courtès
  2019-08-29  7:53   ` sirmacik
  4 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2019-08-25 20:53 UTC (permalink / raw)
  To: Diego Nicola Barbato; +Cc: sirmacik, 34877-done

Hello,

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.

sirmacik <sirmacik@wioo.waw.pl> skribis:

> Unfortunately this is something that affects also printing from
> pdfs. At this point I can see what my printing result will look like
> by opening it in GNU Emacs DocView.

Good news everyone!  Commit 466ff55c72959ba1499ce3ec69f534b3038eb30b
fixes it!  The next commit makes a graft so that the working Ghoscript
is readily available to CUPS, etc.

It turned out that the primary issue was that Freetype was not found at
configure-time, due to the lack of pkg-config…  The commit above
improves a couple of other things in passing, but adding Freetype for
good is apparently the decisive change.

Please let me know if DocView, pdf2ps, and CUPS and all right for you!

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#34877: Ghostscript: Missing text when converting PDF to PS
  2019-08-25 20:53 ` bug#34877: Ghostscript: Missing text when converting PDF to PS Ludovic Courtès
@ 2019-08-29  7:53   ` sirmacik
  0 siblings, 0 replies; 7+ messages in thread
From: sirmacik @ 2019-08-29  7:53 UTC (permalink / raw)
  To: Ludovic Courtès, Diego Nicola Barbato; +Cc: 34877-done

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

that's a great one to hear, thank you!

I'll try it out over the weekend. 


Dnia 25 sierpnia 2019 22:53:17 CEST, "Ludovic Courtès" <ludo@gnu.org> napisał(a):
>Hello,
>
>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.
>
>sirmacik <sirmacik@wioo.waw.pl> skribis:
>
>> Unfortunately this is something that affects also printing from
>> pdfs. At this point I can see what my printing result will look like
>> by opening it in GNU Emacs DocView.
>
>Good news everyone!  Commit 466ff55c72959ba1499ce3ec69f534b3038eb30b
>fixes it!  The next commit makes a graft so that the working Ghoscript
>is readily available to CUPS, etc.
>
>It turned out that the primary issue was that Freetype was not found at
>configure-time, due to the lack of pkg-config…  The commit above
>improves a couple of other things in passing, but adding Freetype for
>good is apparently the decisive change.
>
>Please let me know if DocView, pdf2ps, and CUPS and all right for you!
>
>Thanks,
>Ludo’.

[-- Attachment #2: Type: text/html, Size: 1934 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-08-29  7:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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 ` bug#34877: " Ludovic Courtès
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).