ArtifexSoftware / Ghostscript.NET

Ghostscript.NET - managed wrapper around the Ghostscript library (32-bit & 64-bit)
https://ghostscript.com
GNU Affero General Public License v3.0
391 stars 152 forks source link

Issue regarding fileupload to rasterizer in .net #88

Open dearwebmaker opened 3 years ago

dearwebmaker commented 3 years ago

image

Hi Habjan,

I am trying to give input file from FILEUPLOAD.filename option in C#. But We are getting System.IO.FileNotFoundException: 'Could not find input file.'

jhabjan commented 3 years ago

You need to use absolute path like "C:\MyFiles\CDP.pdf". Ghostscript doesn't know where CDP.pdf is.

dearwebmaker commented 3 years ago

Actually we are giving input from FILEUPLOAD control (from UI)

jhabjan commented 3 years ago

Did you save that file from FileUpload control to the disk before passing it to Ghostscript?

From what I see, you get file via FileUpload control and then just passing file's "client side" name to the Ghostscript.NET. You need to save that file to disk, get absolute path to that file and pass that absolute path Ghostcript.NET.

dearwebmaker commented 3 years ago

Is there any way to pass file directly from FileUpload control to Ghostcript.NET , instead of saving file to folder. ?

jhabjan commented 3 years ago

Yes, you can pass in byte array instead of filename and that would work but file will be saved to the disk anyway. Native Ghostscript requires random access to the file.