I'm trying to remove the vectors from some pdf files. Ghostscript (gs) works fine with -dFILTERVECTOR option:
gswin64c -o "test_out.pdf" -sDEVICE=pdfwrite -dFILTERVECTOR "test.pdf"
but when I run this command on large pdf files (larger than 100MB with more than 1000 pages), I get such error with a blank pdf file as an output:
Page 1139
Page 1140
**** Error: can't process embedded font stream,
attempting to load the font using its name.
Output may be incorrect.
Querying operating system for font files...
Substituting font Courier for AVFCLE+CourierNewPSMT.
Can't find (or can't open) font file %rom%Resource/Font/NimbusMonoPS-Regular.
Can't find (or can't open) font file NimbusMonoPS-Regular.
Can't find (or can't open) font file %rom%Resource/Font/NimbusMonoPS-Regular.
Can't find (or can't open) font file NimbusMonoPS-Regular.
Didn't find this font on the system!
Unable to substitute for font.
**** Error reading a content stream. The page may be incomplete.
Output may be incorrect.
Error: /dictfull in --filter--
Operand stack:
--dict:7/15(L)-- --nostringval-- 9 F_2 26049 11 FontObject --dict:10/18(L)-- false --dict:4/12(L)-- --nostringval-- --nostringval--
Execution stack:
%interp_exit .runexec2 --nostringval-- filter --nostringval-- 2 %stopped_push --nostringval-- filter filter false 1 %stopped_push 1992 1 3 %oparray_pop 1991 1 3 %oparray_pop 1979 1 3 %oparray_pop 1980 1 3 %oparray_pop filter filter 1141 1 1277 filter %for_pos_int_continue 1983 1 7 %oparray_pop filter filter filter filter %array_continue filter filter filter filter filter %array_continue 1827 13 10 %oparray_pop
Dictionary stack:
--dict:734/1123(ro)(G)-- --dict:1/20(G)-- --dict:80/200(L)-- --dict:80/200(L)-- --dict:133/256(ro)(G)-- --dict:317/325(ro)(G)-- --dict:33/64(L)-- --dict:6/9(L)-- --dict:6/20(L)-- --dict:9/15(L)--
Current allocation mode is local
GPL Ghostscript 9.27: Unrecoverable error, exit code 1
Unrecoverable error: VMerror in --.systemvmSFD--
Operand stack:
--nostringval-- --nostringval-- 0
GPL Ghostscript 9.27: ERROR: A pdfmark destination page 1277 points beyond the last page 1139.
It seems that the problem is related to a font issue on page 1140. but in fact, if I treat the file as 2 parts, each part works fine with no problem:
part1: pages from 1 to 1000
gswin64c -o "test_part1.pdf" -sDEVICE=pdfwrite -dFILTERVECTOR -sPageList=-1000 "test.pdf"
part2: from 1001 till the last page (around 1900)
gswin64c -o "test_part2.pdf" -sDEVICE=pdfwrite -dFILTERVECTOR -sPageList=1001- "test.pdf"
So, If I understood well, it seems that it's more related to the number of pages or the size of the pdf file
The pdf files generating the above results are private ones, so I can't upload them. But I have created a 175MB test pdf file (click here to download) which give a similir issue:
Page 1345
**** 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.
Page 1346
*** ERROR: The font BCDEEE+Calibri is damaged and cannot be used. Switching to a
last-ditch fallback, text may not render correctly, or at all.
**** 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.
Page 1347
**** Error: can't process embedded font stream,
attempting to load the font using its name.
Output may be incorrect.
Substituting font Helvetica for BCDEEE+Calibri.
**** 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.
Page 1348
Error: /VMerror in --filter--
VM status: 4 43671928 45257592
Current allocation mode is local
Last OS error: 2
GPL Ghostscript 9.27: Unrecoverable error, exit code 1
Any idea to solve this issue knowing that I'm using the latest version of Ghostscript 9.27 64bit on Windows 10 ?
I 'suspect' that the problem is not related to the use of -dFILTERVECTOR. What happens if you try leaving that off the command line ?
You should also try the most recent Ghostscript code (not yet released) which addresses what may be a related problem.
This commit addressed this bug report which is similar to what you report here. I suspect you haev simply exhausted memory (or at least, memory addressable by Ghostscript).
[EDIT]
Having tested the file, it exhausts memory for me, using 2GB, after 17452 pages (and doesn't require the FILTERVECTOR switch, as I expected).
There is no solution to this. The pdfwrite device requires to keep a significant amount of content in memory in order to keep processing performance reasonable.
In addition your file embeds a new copy of each font on every page. Even though each of those fonts has the same name, we must treat each as a unique font. Failing to do so would mean that we might use the wrong font.
So your file has 1980 pages, and 5 fonts on every page, so that's 9,900 fonts. I strongly suspect that the overhead of keeping all these font copies in memory is what is consuming so much. A quick esitmate (looking at the decompressedd font stream size) would be that the fonts alone would occupy some 792MB of memory. Once you add the Encoding, Widths array, etc this could easily be the major source of memory usage.
Related
My ultimate goal is to know the ink coverage (sDEVICE=ink_cov)of every separation in my PDF including spot color and cmyk. I am trying to pull these out as separate grey scale files so I can process them with ink_cov but every time I run my script I get --nostringval--. I have tried all sorts of combination for naming the channels but nothing works. Here is my script :
gswin64c -dBATCH -dNOPAUSE -sDEVICE=tiffsep -c -sOutputFile=C:\gsfiles\myseps.tiff "<< /SeparationColorNames [/Process Cyan /Process Magenta /Process Yellow /Process Black /myspotred] >> setpagedevice" myspotred.pdf
here is the result
Error: /undefinedfilename in (<< /SeparationColorNames [/Process Cyan /Process Magenta /Process Yellow /Process Black /myspotred] >> setpagedevice)
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:738/1123(ro)(G)-- --dict:0/20(G)-- --dict:75/200(L)--
Current allocation mode is local
Last OS error: Invalid argument
GPL Ghostscript 9.52: Unrecoverable error, exit code 1
Here's the file in acrobat
Acrobat view of separations
Thanks for any help
You don't need to mess with SeparationColorNames.
Even if you did, you need to specify /Cyan not Cyan. The PostScript world doesn't have a /Process key at all, that's NChannel, which is specific to PDF and not supported by PostScript.
You've put a -c in the wrong place (before -sOutputFile instead of before the actual PostScript). Fortunately that is then negated by -sOutputFile. However what that means is that your PostScript fragment is then not treated as PostScript (because that's what -c means and the -c is terminates by the -s). So that chunk of PostScript gets treated as a filename which is why you get an undefinedfilename error.
To get all the separations just do :
gswin64c -sDEVICE=tiffsep -o C:\gsfiles\myseps%d.tiff myspotred.pdf
If you really want to specify the Separation Names then this:
gswin64c -sDEVICE=tiffsep -o C:\gsfiles\myseps%d.tiff -c "<< /SeparationColorNames [/myspotred] >> setpagedevice" -f myspotred.pdf
should be sufficient, The Process colourants are given by the ProcessColorModel of the device, which in this case is CMYK. You don't enter the Process colourants in the SeparationColorNames array for the very good reason that they are not Separation colours.
Note (for general PostScript) that real physical devices may not permit you to change the colourants, they are read only. So you can retrieve them via a currentpagedevice, but setpagedevice may not be able to alter them.
I need to add a white rectangle and some text to the bottom left corner of each page of the PDF document using Ghostscript. To achieve this, I have created the following Postscript script:
<<
/EndPage
{
2 eq { pop false }
{
newpath
0 0 moveto
0 20 lineto
200 20 lineto
200 0 lineto
closepath
%%gsave
1 setgray
fill
%%grestore
1 setlinewidth
0 setgray
stroke
gsave
/Times-Roman 9 selectfont
30 5 moveto
(My text) show
grestore
true
} ifelse
} bind
>> setpagedevice
This works well when combined with a Ghostscript command:
gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=output.pdf my_script.ps input.pdf
However, if input.pdf is in landscape mode, then the white box and text are printed in the upper left corner and not the lower left. I can get it to work by adding:
90 rotate 0 -595 translate
but I can't determine when the pages are in landscape mode vs. portrait mode. I can get the page width and height, but even for landscape mode pages the width is smaller than the height. I tried the following but it fails:
/orient currentpagedevice /Orientation get def
I have been stuck with this for a while. Any help is greatly appreciated!
(Ghostscript version is 9.25)
[UPDATE]
To illustrate how the width is smaller than height for a page in landscape mode, here's the script.ps I am using: https://gist.github.com/irinkaa/9faadf30b3a5a381a0b621d72b712020
And here are the input.pdf and the output.pdf. As you can see, 612.0 - 792.0 is printed inside the output file, showing that width (612) < height (792).
When I re-run the same command on the output file, it prints the same width and height values, but the box is then placed properly in the lower left corner.
When I add the following to the script:
/orient currentpagedevice /Orientation get def
I get an error suggesting orientation isn't set (if I understand correctly):
Error: /undefined in --get--
Operand stack:
orient --dict:212/312(ro)(L)-- Orientation
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1999 1 3 %oparray_pop 1998 1 3 %oparray_pop 1982 1 3 %oparray_pop 1868 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval--
Dictionary stack:
--dict:977/1684(ro)(G)-- --dict:0/20(G)-- --dict:80/200(L)--
Current allocation mode is local
Current file position is 151
GPL Ghostscript 9.25: Unrecoverable error, exit code 1
First you should upgrade your version of Ghostscript. 9.25 is old, and has security vulnerabilities.
Secondly you need to look at both the /Orientation and /PageSize entries in the page device dictionary. Not only that but you should use the PageSize to determine the translate you are using for your 'adjustment'. Unless you are in a fixed workflow (and that seems unlikely if you are receiving mixed orientation files) then you should not assume that the media is A4.
The Ghostscript PDF interpreter looks at the MediaBox on each page of the PDF file and resets the /PageSize in the page device dictionary to match the MediaBox for the page. It will (IIRC) never set the /Orientation, if the PDF page has a /Rotate entry then that gets applied to the MediaBox and the contents of the page.
So you really just need to look at the width and height of the requested media, which is given by the /PageSize array in the page device dictionary.
Now having said that....
You say that 'even for landscape mode pages the width is smaller than the height'. That seems unlikely to me, but in the absence of an example it's hard to tell. It also makes it hard for anyone to offer any kind of advice.
I'd suggest you upload an example somewhere, and post the URL here so we can look at the file.
Oh, and I'd really recommend that you don't send the output file to stdout. It may well be convenient for you but there are already certain features of the pdfwrite device which simply won't work if you do that (they require the output file to be seekable) and there may be more cases in future.
Edit
Your problem is execution order. The program in script.ps runs before the PDF file is interpreted, then the PDF file is interpreted.
When all your program is doing is setting an EndPage procedure in the page device dictionary that's not a problem, alterations to the page device dictionary are conservative, they accumulate unless specifically overwritten.
So the fact that during the course of interpreting the PDF file changes occur to the page device dictionary doesn't matter (unless that were somehow to alter the EndPage procedure).
But at the time your program runs, the page device dictionary /PageSize key has an associated value which is an array containing the default media size (because nothing has happened to change it yet). The PageSize entry won't be altered until the PDF file gets interpreted. This means that no matter what size media your PDF file used, your program will always return the default media size.
You need to know the actual PageSize at the time the EndPage procedure is executed. So you need to investigate the current PageSize as part of the EndPage procedure.
Something like:
<<
/EndPage
{
2 eq { pop false }
{
% Get the current page device dictionary and extract the PageSize
currentpagedevice /PageSize get
% Load the values from the array onto the stack
% and discard the array copy returned by the aload operator
aload pop
% If width < height (or equal, square page)
le {
% Handle a portrait page
} {
% Handle a landscape page
} ifelse
}ifelse
} bind
>> setpagedevice
Note that this avoids creating a dictionary entry to hold the page width and height. There are several reasons for doing this;
Firstly the width and height can be different for every page (particularly in a PDF file).
Secondly you don't (in your program) create your own dictionary to store these key/value pairs which means that you are using whatever dictionary is active at the time. While that's sort of acceptable the way you have it currently, because userdict will be active at the start of the program, you have no way to know which dictionary is on top of the dictionary stack when EndPage is called. So it's not safe to just poke values into whatever dictionary happens to be top, you might end up overwriting keys with the same name, which would lead to unpredictable side effects. Likewise (as per Orientation below) if the current dictionary doesn't contain those keys, you would get an undefined error. So you're getting away with this through luck right now.
Thirdly it's generally considered better practice in PostScript to use the stack for temporary storage, rather than creating key/value pairs in dictionaries.
For the latter two reasons I'd very strongly suggest that instead of creating a key called stringholder (as your program currently does) in whatever dictionary is on top of the dictionary stack at the start of the program, and assuming it will be available during the EndPage procedure, you should instead simply create a temporary string by using 10 string instead.
Eg:
/Times-Roman 9 selectfont
30 5 moveto
pagewidth
stringHolder cvs
show
would become:
/Times-Roman 9 selectfont
30 5 moveto
currentpagedevice /PageSize get 0 get
256 string cvs
show
10 digits is possibly a little small, 256 should be enough for anyone and the string will be garbage collected so it isn't like you are leaking memory or anything.
As regards Orientation; yes, you are correct, and as I said initially the PDF interpreter doesn't set Orientation in the page device dictionary. If you try to get a key from a dictionary which doesn't contain that key then you get an undefined error. If you are uncertain whether a key exists in a dictionary you should check it first using the known operator.
Edit 2
As noted in the comments below, it's possible to test the orientation of the CTM by using the transform operator and the unit vector. If either or both of the co-ordinates resulting from transform are negative then there is rotation involved in the CTM and by examining the sign of each co-ordinate we can determine which quadrant the rotation ends up in.
For the purposes of the /Rotate flag in PDF that's sufficient, as it can only be specified in 90 degree increments. Here is an example function which determines the rotation, and a simple piece of PostScript to exercise it:
%!PS
/R {
1 1 transform
0 ge {
0 ge {
(no rotation\n) print
} {
(90 degree ccw rotation\n) print
} ifelse
} {
0 ge {
(270 ccw rotation\n) print
} {
(180 ccw rotation\n) print
} ifelse
} ifelse
} bind def
R
gsave
90 rotate R
grestore
gsave
180 rotate R
grestore
gsave
270 rotate R
grestore
gsave
360 rotate R
grestore
It's possible to use this technique to decide if the original file has been rotated, and then choose to have the EndPage procedure behave differently.
"but I can't determine when the pages are in landscape mode vs. portrait mode"
$ gs -sDEVICE=bbox -dNOPAUSE -dBATCH input.pdf | grep %B
%%BoundingBox: -1 0 842 596
%%HiResBoundingBox: -0.008930 0.018000 841.988998 595.223982
%%BoundingBox: -1 0 842 596
%%HiResBoundingBox: -0.008930 0.018000 841.988998 595.223982
Then you can have a script-portrait.ps and a script-landscape.ps as appropriate.
EDIT: I agree with KenS. The ghostscript pdfwrite output creates a different layout from the original pdf created by Acrobat Distiller 10.1.1 (Windows). I found this difference even without including the EndPage script.
I am trying to fix my pure black colored text problem in PDF conversion. I am able to convert my sRGB pdf to CMYK pdf but text colors are not kept in pure black. I already tried to use ghostscript: convert PDF into CMYK preserving pure Black for text trick but even I compiled "apple_..." files in my current directory, I always get :
gsicc_open_search(): Could not find ~/temp/AdobeCPs/CMYK/apple_to_jNP_neutrals.icc .
the command I am using:
gs -q -sDEVICE=pdfwrite -o sample.pdf -sColorConversionStrategy=CMYK
-sSourceObjectICC=control.txt test.pdf
My output is :
./base/gsicc_manage.c:1088: gsicc_open_search(): Could not find Graphic_RGB apple_to_jNP_neutrals.icc 0 1 0
+ ./base/gsicc_manage.c:660: gsicc_set_srcgtag_struct(): setting of control.txt src obj color info failed
| ./base/gsicc_manage.c:2731: gs_setsrcgtagicc(): cannot find srctag file
While reading gs_lev2.ps:
Error: /unknownerror in --.setuserparams--
Operand stack:
(gs_res.ps\000gs_typ42.ps\000gs_cidfn.ps\000gs_cidcm.ps\000gs_fntem.ps\000gs_cidtt.ps\000gs_cidfm.ps\000gs_cmap.ps\000gs_setpd.ps\000gs_fapi.ps\000gs_typ32.ps\000gs_frsd.ps\000gs_ll3.ps\000gs_mex_e.ps\000gs_mro_e.ps\000gs_pdf_e.ps\000gs_wan_e.ps\000pdf...) (gs_lev2.ps) --dict:31/31(G)-- --dict:1/1(G)-- --dict:1/1(G)--
Execution stack:
%interp_exit --nostringval-- --nostringval-- %loop_continue --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push --nostringval-- --nostringval--
Dictionary stack:
--dict:798/1123(G)-- --dict:71/200(L)-- --dict:798/1123(G)-- --dict:133/251(G)-- --dict:21/25(L)--
Last OS error: No such file or directory
Current file position is 24631
Unrecoverable error: syntaxerror in --nostringval--
Operand stack:
gs_res.psgs_typ42.psgs_cidfn.psgs_cidcm.psgs_fntem.psgs_cidtt.psgs_cidfm.psgs_cmap.psgs_setpd.psgs_fapi.psgs_typ32.psgs_frsd.psgs_ll3.psgs_mex_e.psgs_mro_e.psgs_pdf_e.psgs_wan_e.pspdf_ops.psgs_l2img.pspdf_rbld.pspdf_base.pspdf_draw.pspdf_font.pspdf_main.pspdf_sec.psgs_cff.psgs_mgl_e.psgs_ttf.psgs_icc.psgs_dps.psgs_dpnxt.psgs_epsf.psgs_pdfwr.ps gs_lev2.ps --nostringval-- --nostringval-- --nostringval-- false
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
gs_res.psgs_typ42.psgs_cidfn.psgs_cidcm.psgs_fntem.psgs_cidtt.psgs_cidfm.psgs_cmap.psgs_setpd.psgs_fapi.psgs_typ32.psgs_frsd.psgs_ll3.psgs_mex_e.psgs_mro_e.psgs_pdf_e.psgs_wan_e.pspdf_ops.psgs_l2img.pspdf_rbld.pspdf_base.pspdf_draw.pspdf_font.pspdf_main.pspdf_sec.psgs_cff.psgs_mgl_e.psgs_ttf.psgs_icc.psgs_dps.psgs_dpnxt.psgs_epsf.psgs_pdfwr.ps gs_lev2.ps --nostringval-- --nostringval-- --nostringval-- false
My control.txt file is :
Image_RGB apple_to_jNP_photo.icc 0 1 0
Graphic_RGB apple_to_jNP_neutrals.icc 0 1 0
Text_RGB apple_to_jNP_neutrals.icc 0 1 0
echo $GS_LIB
/usr/share/ghostscript/9.18/Resource
ls /usr/share/ghostscript/9.18/Resource
CIDFont CIDFSubst CMap ColorSpace Decoding Encoding Font IdiomSet Init SubstCID
current directory :
~/temp/AdobeCPs/CMYK$ ls
AppleRGB.icc CoatedGRACoL2006.icc JapanColor2003WebCoated.icc USWebCoatedSWOP.icc
apple_to_jNP_neutrals.icc control.txt JapanWebCoated.icc USWebUncoated.icc
apple_to_jNP_photo.icc JapanColor2001Coated.icc sample.pdf WebCoatedFOGRA28.icc
CoatedFOGRA27.icc JapanColor2001Uncoated.icc test.pdf WebCoatedSWOP2006Grade3.icc
CoatedFOGRA39.icc JapanColor2002Newspaper.icc UncoatedFOGRA29.icc WebCoatedSWOP2006Grade5.icc
Could you help ?
Even though this is a quite old thread it seems not yet solved.
I had the same error as mentioned above with blanks as separators in the control.txt instead of tabs (as mentioned in the Ghostscript version Color Management WhitePaper).
Changing to tabs fixed the problem for me.
Your command line and input file isn't relevant to the problem, the failure is during startup:
| ./base/gsicc_manage.c:2731: gs_setsrcgtagicc(): cannot find srctag
file While reading gs_lev2.ps:
gs_lev2.ps is part of Ghostscript's startup code. That's all executed before you even get to the point of reading the command line options.
You haven't said which version of Ghostscript you are using, on which OS, or where you got it from, but it looks to me like you version is fundamentally broken.
I infer from your text that you are using version 9.18, that's 5 versions (2.5 years) out of date, the current version is 9.23. I'd suggest you get the vanilla Ghostscript source from the downloads page and compile that.
I have several Postscript files I need to convert to PDF for work. (No I cannot send you the PS files, it's confidential).
They were created using Adobe 3.0 standards :
(%!PS-Adobe-3.0
%%Creator: Emtex - vdd2ps 212.5.1)
So i need to invoke ps2pdf12.
When I try ps2pdf12 test.ps output.pdf I get this :
"Error: /undefined in ps2pdf12
Operand Stack:
Execution stack :
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-
- 2 %stopped_push --nostringval-- --nostringval-- %loop_continue --n
ostringval-- --nostringval-- false 1 %stopped_push .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval
--
Dictionary stack:
--dict:1166/1684(ro)(G)-- --dict:0/20(G)-- --dict:77/200(L)--
Current allocation mode is local
Current file position is 9
"
I run the script using GhostScript 9.05 or 9.20 and I get the same error.
I also tried using directly ghostScript with things like
"gs -o "output.pdf" -sDEVICE=pdfwrite -dCompatibilityLevel=1.2 -r=720 "test.PS" "
but I get the same mistakes.
When I am in Ghostview to watch my PS and I go to File-->Convert and I choose pdfwrite and resolution = 720, I get the pdf...
Any ideas where my problem come from?
Thanks in advance
If the PostScript program causes Ghostscript to throw an error, then the PostScript program is most likely defective.
I'm afraid that the fact that the file begins with %!PS-Adobe-3.0 doesn't mean much. That is actually supposed to be the version of the Document Structuring Convention which the program is compatible with, but unfortunately many PostScript producers don't understand that, and thinking that it just means 'this is a PostScript file' stick it on the front. SO you can't read anything from it.
I'm afraid that if you can't share an example of the program then there is, frankly, almost nothing anyone can do to help. My guess (and that's all it is without seeing an example) is that the PostScript is broken.
After several tries and checks with GSView, i managed to get the following quote and it seems to work fine.
gswin32c.exe -o "output.pdf" -dNOSAFER -sDEVICE=pdfwrite -r720 -dAutoRotatePages=false -dCompatibilityLevel=1.2 -dUseFlateCompression=true -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -dNumRenderingThreads=2 -c "60000000 setvmthreshold" -f -dEPSCrop "test.PS"
Thanks for your help :)
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
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.
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.