c# - What is causing Ghostscript to return an error of -100? -


so, using matthew ephraim's ghostscriptsharp, simple c# wrapper unmanaged win32 ghostscript dll in asp.net mvc project. background:

what attempting have user upload pdf, , convert document image can save off whatever directory choose (as other oop tie new image site).

i decided use mr. ephraim's wrapper class (ghostscriptsharp) because simple enough use, , gives me relatively clean access dll's api.

to test it, created dummy c# console application make sure load dll, access it, hand pdf file on local disk , have write jpg same local disk. after few learning experiences, had success. hand c:\input.pdf, hand me c:\output.jpg.

however, after integrating ghostscriptsharp code had in console application asp.net mvc project point of calling dll p/invoke, ghostscript returning int/error code -100, fatal error (is called e_fatal in ghostscript source code). same result both file uploaded through html form, , if hand exact same hard-coded paths used in working console application.

for reference, lines exception thrown 93-97 in ghostscriptsharp.cs (which in callapi function):

int result = initapi(gsinstanceptr, args.length, args);  if (result < 0) {   throw new externalexception("ghostscript conversion error", result); } 

obviously exception thrown because result -100.

when initapi called, instance ptr valid int (though don't know if instance of gs correct or not), args has length of 20 (is string[]) of valid ghostscript options (including correctly-escaped paths input & output files).

long story short, doing wrong? error code -100 seems catch-all because there no documentation states possibly going wrong here.

any appreciated, thank in advance.

the -100 error generic "fatal error" in ghostscript.

a few things check:

1) permissions (al operations require file access)

2) scope, want add gs bin folder path variables

3) consider not calling ghostscript directly asp.net, gs can cpu intensive, rather process files in separate service

i have created wrapper, send me email (address on profile) , send you. allows 1 pass in gs bin folder helps.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -