Print PDF file?

Dec 10, 2014 at 12:56 PM
Edited Dec 10, 2014 at 12:57 PM
Hi,

I'm new to ghostscript but I have managed to print a pdf file in a WPF application using the commandline api for Ghostscript and GSView.

This is my working code:
string gsExecutable = string.Format(@"{0}", _config.GhostScript_Executable_Path);
                    string gsViewExecutable = string.Format(@"{0}", _config.GSView_Executable_Path);
                    string printerName = _config.MyPrinterName;

                    string processArgs = string.Format("-ghostscript \"{0}\" -dPDFFitPage -copies=1 -all -printer \"{1}\" \"{2}\"", gsExecutable, printerName, PDFFilePath);

                    var gsProcessInfo = new ProcessStartInfo
                    {
                        WindowStyle = ProcessWindowStyle.Hidden,
                        FileName = gsViewExecutable,
                        Arguments = processArgs
                    };

                    using (var gsProcess = Process.Start(gsProcessInfo))
                    {
                        gsProcess.WaitForExit();

                        gsProcess.Disposed += (ps, pe) =>
                        {
                            //Printing success!!
                        };
                    }
I'm wondering now how I can achive this with the Ghostscript.NET library? Can someone help me with an example for the things I'm already doing in a Ghostscript.NET way?
Coordinator
Feb 2, 2015 at 12:35 PM
Hi,

Sorry for delay. You can do a same by using GhostscriptProcessor class. The sample can be found here: https://github.com/jhabjan/Ghostscript.NET/blob/master/Ghostscript.NET.Samples/Samples/ProcessorSample.cs

Cheers,
Josip