views:

15

answers:

2

I've got a bit of an issue with Ghostscript. I'm writing an application in .NET that uses the Ghostscript API, gs32dll.dll. It works just fine for a number of pdfs, but there a couple that have this little movie can dingbat, and ghostscript throws an error about not having that font. I know I have to make a listing for that font in the cidfmap file, but since I'm not using an actual install of ghostscript, I don't have local paths pointing to that file. I want this program to be installed on a number of computers, but I'd rather not install the full blown ghostscript on these computers. So, I was wondering if it would be possible to put a copy of cidfmap in with the dll. I figured it might look in its path first. I'd even be cool with ghostscript skipping the conversion of that character. I'm open to any ideas.

About the program:
I teach math. We have these note taking guides on pdf. Every section in each chapter has two pdfs, one with and one without answers. I'm using ghostscript to convert the pdfs to images (jpegs). Once finished, the user will be able to use the smartboard pen to highlight the area where an answer would be, and the answer will be cut from the answer document image and pasted on the same location of the blank document. I plan on giving this out to the other math teachers once I've finished. I'd like to keep the program self contained, so I don't have to explain to them how to install ghostscript and whatnot. I'd just like to hand them a folder.

Revision = 900

RevisionDate = 20100914

Product = GPL Ghostscript

Copyright = Copyright (C) 2010 Artifex Software, Inc. All rights reserved.

GPL Ghostscript 9.00 (2010-09-14)

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 5.

Page 1

Page 2

Can't find CID font "ZapfDingbats".

Substituting CID font /Adobe-Identity for /ZapfDingbats, see doc/Use.htm#CIDFont

Substitution.

The substitute CID font "Adobe-Identity" is not provided either. Will exit with error.

Error: /undefined in findresource

Operand stack:

--dict:11/20(L)-- G27 1 --dict:5/5(L)-- --dict:5/5(L)-- ZapfDingbat s-Identity-H --dict:10/12(ro)(G)-- --nostringval-- CIDFontObject --dict: 7/7(L)-- --dict:7/7(L)-- Adobe-Identity Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval- - 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- fa lse 1 %stopped_push 1910 1 3 %oparray_pop 1909 1 3 %oparray_ pop 1893 1 3 %oparray_pop --nostringval-- --nostringval-- 3 1 5 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- false 1 %stopped_push --nostringval-- %loop_continue --nostringval-- --nos tringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval -- %array_continue --nostringval-- --nostringval-- --nostringval-- --n ostringval-- --nostringval-- %loop_continue Dictionary stack: --dict:1158/1684(ro)(G)-- --dict:1/20(G)-- --dict:82/200(L)-- --dict:82 /200(L)-- --dict:108/127(ro)(G)-- --dict:293/300(ro)(G)-- --dict:23/30(L)- - --dict:6/8(L)-- --dict:22/40(L)-- --dict:14/15(L)--

Current allocation mode is local

Last OS error: No such file or directory

GPL Ghostscript 9.00: Unrecoverable error, exit code 1

A: 

How about separating your program in a client and a server part?

Then a server could have all of Ghostscript and all kinds of fonts installed on it, and the clienst accessing this server would not need Ghostscript at all.

Might help with licensing issues too, depending on your situation.

In response to edited question:

Probably you can install Ghostscript locally to a portable folder within your program drectory:

Look at this forum comment for inspiration. I know others have succeeded too.

Amigable Clark Kant
I added a little more about the program. I want the program to be self contained so I can just hand the folder with the program to other teachers. I'd rather them not have to install anything. This is why I went with the API rather than calling the program directly.
freeman_irl
A: 

On a Linux commanline, invoke

gs -h  

on Windows, invoke

gswin32c.exe -h

This should show you the search path(s) used by your instance of Ghostscript. This may help you to determine where in your folder structure you'd have to place your font resource.

You can also use an additional CLI parameter to override any builtin search paths:

gswin32c.exe ^
   -I"d:/absolute/path/to/dir;../relative/path/to/dir;c:/other dir with spaces" ^
   [...]

Note that on Windows Ghostscript is able to use forward slashes as directory delimiters for paths.

I'm sure you can somehow add that sort of invocation (-I...) to your software.

pipitas