Search code examples
fontsghostscriptembedded-fonts

Ghostscript font conversion issue


All,

I'm having an issue with a font in a pdf. In the original, it shows a solid line, but if I copy it, I get this ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ on the clipboard.

That indicates to me it is some special font being used, which would be fine. The problem is that I use this pdf as input to ghostscript, and the line become a bunch of boxes with X in them. Line in pdf

Boxes in pdf

After some searching, I came across this answer. The -c command successfully removes the boxes, but the line is still missing.

Running gswin64c.exe -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf USA_15238-2897_5853101.pdf on a windows 7 64 bit system, I get the following output:

GPL Ghostscript 9.04 (2011-08-05)
Copyright (C) 2011 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 2.
Page 1
Substituting font Courier-Bold for CourierNew,Bold.
Loading NimbusMonL-Bold font from %rom%Resource/Font/NimbusMonL-Bold... 3825552 2503053 2085544
 779106 3 done.
Substituting font Courier for CourierNew.
Loading NimbusMonL-Regu font from %rom%Resource/Font/NimbusMonL-Regu... 3986304 2660967 2146096
 844377 3 done.
Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Querying operating system for font files...
Didn't find this font on the system!
Substituting font Helvetica for ArialMT.
Loading NimbusSanL-Regu font from %rom%Resource/Font/NimbusSanL-Regu... 4100320 2785188 2226832
 918025 3 done.
Page 2
Substituting font Courier-Bold for CourierNew,Bold.
Substituting font Courier for CourierNew.

Adding the windows fonts folder as a fontpath switch allows for finding the fonts, but does not fix the line to boxes problem.

Running gswin64c.exe -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf -c ".setpdfwrite <</NeverEmbed [ ]>> setdistillerparams" -f USA_15238-2897_5853101.pdf produces this:

GPL Ghostscript 9.04 (2011-08-05)
Copyright (C) 2011 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 2.
Page 1
Substituting font Courier-Bold for CourierNew,Bold.
Loading NimbusMonL-Bold font from %rom%Resource/Font/NimbusMonL-Bold... 3825552 2503973 2105728
 793286 3 done.
Substituting font Courier for CourierNew.
Loading NimbusMonL-Regu font from %rom%Resource/Font/NimbusMonL-Regu... 3986304 2661903 2166280
 858469 3 done.
Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Can't find (or can't open) font file %rom%Resource/Font/ArialMT.
Can't find (or can't open) font file ArialMT.
Querying operating system for font files...
Didn't find this font on the system!
Substituting font Helvetica for ArialMT.
Loading NimbusSanL-Regu font from %rom%Resource/Font/NimbusSanL-Regu... 4100320 2786124 2247016
 932205 3 done.
Page 2
Substituting font Courier-Bold for CourierNew,Bold.
Substituting font Courier for CourierNew.

But the line is now spaces in the pdf. If I copy and paste it, I get ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─.

What ghostscript switch do I need to add to keep the line from the original pdf?


Solution

  • Its impossible to say what's going on without seeing your PDF file. Be aware that copy+paste is not ever guaranteed to work, especially after conversion to PDF by Ghostscript.

    Since you already have a PDF file, why are you converting it to PDF ?

    The most likely problem is the substitution of Courier for Courier-New, but without seeing the file I can't be certain.