0

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?

Community
  • 1
  • 1
Spencer Rathbun
  • 14,510
  • 6
  • 54
  • 73

1 Answers1

1

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.

KenS
  • 30,202
  • 3
  • 34
  • 51
  • I'm using Ghostscript to combine several of these pdfs. I don't care about copy and paste, I care about the appearance. I just mentioned the copying because it seems to indicate that a unicode font is being used to produce the line, instead of a vector graphic. I can't provide the original pdf, as it contains sensitive data. What's the difference between `Courier` and `Courier-New`? – Spencer Rathbun Mar 02 '12 at 13:28
  • I'm going to accept this as the answer, since it was the `Courier` font substitution. Thanks for pointing me in the right direction. – Spencer Rathbun Mar 02 '12 at 16:45
  • but what was the switch in ghostscript that fixed the courier font substitution? – Joe Apr 25 '13 at 13:03
  • Almost certainly there was no switch, but adding a font declaration for Courier-New would work, provided the Courier-New font had the proper glyph at the requisite code point. Please note that Ghostscript will only substitute fonts if the font is not present in the input file, and you haven't told it where to find a named alternative. – KenS Apr 25 '13 at 13:14