I need to convert pdf-files into images with a script in C# for Unity. Ghostscript shouldn't be installed on disk to do this. I tried to include the ghostscript .dll and use it with a wrapper which uses the following functions:
gsapi_new_instance
gsapi_init_with_args
gsapi_exit
gsapi_delete_instance
However, if I use the commands -sDEVICE=png16m -sOutputFile=outputpath.png inputpath.pdf as arguments, it is not working. The first page of the pdf file is created but the others are not. I used "-%d" in the outputpath, but it's not working either. e.g. C:\Example-%d.png
I am using Ghostscript version 9.16, Unity version 5.2.0f3 and Visual Studio 2015.
Can please anyone tell me, why the first image file is created and the others are not? Is there any simple alternative for using ghostscript to create multiple images from a pdf by using C#?