Quantcast
Channel: Ghostscript.NET
Viewing all articles
Browse latest Browse all 393

New Post: Error when trying to run a processor

$
0
0
My intention is to convert a PDF to PNG, GhostscriptReasterizer first tried using the class and it worked correctly, but I can not set the output parameters all I wanted.

Then I took on the example of GhostscriptProcessor, but when I run it shows me an error "An error occured When call to 'gsapi_init_with_args' is made​​: -100".

This is the code:
        GhostscriptVersionInfo version = null;
        version = GhostscriptVersionInfo.GetLastInstalledVersion(GhostscriptLicense.GPL | GhostscriptLicense.AFPL, GhostscriptLicense.GPL);

        GhostscriptProcessor processor = new GhostscriptProcessor(version, false);

        processor.Processing += ShowStatus;
        processor.StartProcessing(GetArgs().ToArray(), null);
Arguments are defined in this function:
    IList<string> GetArgs()
    {
        IList<string> args = new List<string>();

        //args.Add("-dDOINTERPOLATE");
        //args.Add("-dGraphicsAlphaBits=4");
        //args.Add("-dDownScaleFactor=3");
        //args.Add("-dSAFER");
        //args.Add("-dBATCH");
        //args.Add("-dNOPAUSE");
        args.Add("-sDEVICE=pnggray");
        //args.Add("-r600");
        args.Add(string.Format("-otest.png");
        //args.Add("-q");
        args.Add("-f");
        args.Add(string.Format("test.pdf");
        return args;
    }
I tried different combinations, and I tried with Ghostscript command line app, with the same parameters:

gswin64c -sDEVICE=pnggray -otest.png -f test.pdf

And work fine.

Best Regards
Alejandro

Viewing all articles
Browse latest Browse all 393

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>