This project is read-only.

How to print file

Nov 24, 2013 at 2:37 AM

i've tried to use this fine library to print a file as suggested on stackoverlow.
Used x64 and latest GPL GhostScript library.

Used all posiible options, but no luck, always get error -100.

PDF is very simple and can be rendered by Viewer without any problems.

input: name of PDF file
output: name of printer

Tried use with %printr% and spool.
Tried drivers mswinpr2, pswrite, ljet4.

Here an example code:
    private void Process(string input, string output, int startPage, int endPage)

        //-dPrinted -dBATCH -dNOPAUSE -sDEVICE=mswinpr2 -dNoCancel -sOutputFile="%printer%printer name" "pdfdocument.pdf"

        List<string> switches = new List<string>();

        //switches.Add(@"-sOutputFile=""%printer%" + output + @"""");
        switches.Add("-sOutputFile=\"\\\\spool\\" + output + "\"");
        //switches.Add(@"-sOutputFile=""" + output + @"""");
        switches.Add(@"-sFONTPATH=" + System.Environment.GetFolderPath(System.Environment.SpecialFolder.Fonts));
        switches.Add("-dFirstPage=" + startPage.ToString());
        switches.Add("-dLastPage=" + endPage.ToString());
        switches.Add(@"-f""" + input + @"""");
        //switches.Add(@"""" + input + @"""");

        using (Ghostscript.NET.Processor.GhostscriptProcessor processor = new Processor.GhostscriptProcessor(_gs_verssion_info, true))
            //processor.Process(CreateTestArgs(input, output, startPage, endPage), new ConsoleStdIO(true, true, true));
            processor.StartProcessing(switches.ToArray(), null);
``` Man thanks in advice!

Nov 26, 2013 at 7:59 AM
Hi Alex,

Did you and can you try to print this PDF directly through gswin64.exe by using switches you used via Ghostscript.NET?
Ghostscript.NET is straight-forward so I don't think so it's something wrong with the C# part of the code.

I would suggest you to connect to the "" IRC server (channel: #ghostscript) and ask this question there as this is more Ghostscript native question.
You can use web based IRC client:

Dec 23, 2013 at 7:03 PM
I do get the same error on this.
I can print my file calling ghostscript directly, so my pdf is ok.
Dec 24, 2013 at 6:11 PM
It turned out that I needed administrator rights on visual studio .exe
Dec 28, 2013 at 3:16 PM
Hi 'hheuvelman',

Thank you for solving this issue, I hope it will work out 'code74' problem also.

Only thing I can suggest here is adding a requestedExecutionLevel element to your application manifest.
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />