Adding New Roman Time to Ghostscript in Ubuntu

Using Ghostscript 8.71 in Ubuntu, but the problem is reading a PDF file with a temporary roman font on all its pages.

I downloaded the msttcorefonts package and created a Fontmap file for Ghostscript, but that just doesn't work.

My Fontmap file is as follows:

/Times (/usr/share/fonts/truetype/msttcorefonts/times.ttf); /Times-Roman (/usr/share/fonts/truetype/msttcorefonts/times.ttf); /Times-Bold (/usr/share/fonts/truetype/msttcorefonts/timesbd.ttf); /Times-BoldItalic (/usr/share/fonts/truetype/msttcorefonts/timesbi.ttf); /Times-Italic (/usr/share/fonts/truetype/msttcorefonts/timesi.ttf); 

Ghostscript command that I use:

 gs -sFONTMAP=/usr/share/ghostscript/8.71/Fontmap bad.pdf -o good.pdf 

And this is the error I get:

 GPL Ghostscript 8.71 (2010-02-10) Copyright (C) 2010 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Processing pages 1 through 3. Page 1 Error: /undefined in --run-- Operand stack: --dict:5/14(L)-- F2 11.0 FontObject --dict:8/8(L)-- --dict:8/8(L)-- 397 --dict:8/8(L)-- Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1878 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 3 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- false 1 %stopped_push --nostringval-- %loop_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- Dictionary stack: --dict:1151/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)-- --dict:75/200(L)-- --dict:108/127(ro)(G)-- --dict:288/300(ro)(G)-- --dict:22/25(L)-- --dict:6/8(L)-- --dict:25/40(L)-- --dict:1151/1684(ro)(G)-- --dict:10/10(L)-- Current allocation mode is local Last OS error: 2 GPL Ghostscript 8.71: Unrecoverable error, exit code 1 

Can someone help me with this? I feel that I have exhausted all the possibilities that I can think of.

Here is the PDF file that I am trying to run through Ghostscript: bad.pdf

If I download all fonts like this:

 gs -c 'loadallfonts quit' 

Then the only links to the Times New Roman font:

 Loading TimesNewRomanPS-BoldItalicMT font from /usr/share/fonts/truetype/msttcorefonts/timesbi.ttf... 4310316 2923512 4001304 2206507 1 done. 

Reading the properties of the attached PDF, I see that he really wants TimesNewRomainPSMT . Why doesn't gs download all the fonts in the msttcorefonts folder?

+4
source share
1 answer

This is what pdffonts utility pdffonts about bad.pdf :

  pdffonts bad.pdf 
 name type encoding emb sub uni object ID
 --------------------------- ----------------- ------ ---------- --- --- --- ---------
 Times-Roman Type 1 WinAnsi no no no 12 0
 DejaVuSerifCondensed Type 1 WinAnsi yes no no 13 0
 DejaVuSansCondensed Type 1 WinAnsi yes no no 16 0
 DejaVuSansCondensed-Bold Type 1 WinAnsi yes no no 19 0

This means the following:

  • The font name that is not implemented is Times-Roman , not TimesNewRomanPSMT , as you think. (I think you used the Adobe Acrobat / Reader File Properties dialog box to look at the font properties? And did you see this font name marked as "Actual font" or similar? TimesNewRomanPSMT this mean that Acrobat uses this font called TimesNewRomanPSMT how to replace , because it does not have a font named Times-Roman )!

  • There are 3 fonts from the DejaVu family. They are not subsets, but embedded as full fonts.

So far so good ...

Or?

Now let's see what happens if I try to let the new version of Ghostscript compiled from current Git sources handle this bad.pdf :

  gs -o new.pdf -sDEVICE = pdfwrite bad.pdf

  GPL Ghostscript GIT PRERELEASE 9.16 (2014-09-22)
  Copyright (C) 2014 Artifex Software, Inc.  All rights reserved.
  This software comes with NO WARRANTY: see the file PUBLIC for details.
  Processing pages 1 through 3.
  Page 1
    **** Warning: can't process font stream, loading font by the name.
  Substituting font Helvetica-Narrow for DejaVuSerifCondensed.
  Loading NimbusSanL-ReguCond font from% rom% Resource / Font / NimbusSanL-ReguCond ... 4671296 3041958 2433440 1055875 3 done.
  Loading NimbusRomNo9L-Regu font from% rom% Resource / Font / NimbusRomNo9L-Regu ... 4688240 3115971 2494016 1110728 3 done.
  Page 2
    **** Warning: can't process font stream, loading font by the name.
  Substituting font Helvetica-Narrow for DejaVuSerifCondensed.
  Page 3
    **** Warning: can't process font stream, loading font by the name.
  Substituting font Helvetica-Narrow for DejaVuSerifCondensed.

    **** This file had errors that were repaired or ignored.
    **** The file was produced by: 
    **** ====== mPDF 4.6 ======
    **** Please notify the author of the software that produced this
    **** file that it does not conform to Adobe published PDF
    **** specification.

Thin embedded fonts cannot be processed by Ghostscript.

This PDF seems to have a lot more errors than you think.

+1
source

All Articles