Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work in Windows Server 2012 R2 #41

Closed
tarcisiomartins opened this issue Dec 21, 2017 · 2 comments
Closed

Doesn't work in Windows Server 2012 R2 #41

tarcisiomartins opened this issue Dec 21, 2017 · 2 comments

Comments

@tarcisiomartins
Copy link

tarcisiomartins commented Dec 21, 2017

Hi, I am using Ghostscript.NET in my Project to print Pdf files using Network. Locally works fine, using Windows 10, version 64 bits and Ghostscript Driver to 32-Bit (Ghostscript 9.22 for Windows 32-Bit) downloaded from https://www.ghostscript.com/download/gsdnld.html. The motivation to install 32-Bit version is the exception,

Ghostscript.NET.GhostscriptLibraryNotInstalledException: This managed library is running under 32-Bit process and requires 32-Bit Ghostscript native library installation on this machine! To download proper Ghostscript native library please visit: http://www.ghostscript.com/download/gsdnld.html

, which occurs in my application log when using Ghostscript 64 bits Driver.

The target Operation System where I published my application is Windows Server 2012 R2. Using same Ghostscript Driver (Ghostscript 9.22 for Windows 32-Bit), print command loops indefinitely, without response to my application.

My application reads pdf file from disk and sends it to Network Printer using Ghostscript. For simulating the process I connect to client machine remotely using TeamViewer. So, I call a REST Web Service from this machine, which saves the file to disk and uses Ghostscript to print the document in a Network Printer.

try
                {
                    var task = Task.Run(() =>
                    {
                        using (GhostscriptProcessor processor = new GhostscriptProcessor(GhostscriptVersionInfo.GetLastInstalledVersion(), true))
                        {
                            List<string> switches = new List<string>();
                            switches.Add("-empty");
                            switches.Add("-dPrinted");
                            switches.Add("-dBATCH");
                            switches.Add("-dNOPAUSE");
                            switches.Add("-dNOSAFER");
                            switches.Add("-dPDFFitPage");
                            switches.Add("-dNumCopies=" + numCopias);
                            switches.Add("-sDEVICE=mswinpr2");
                            switches.Add("-sOutputFile=%printer%" + "\\\\" + printerIP + "\\" + printerNAME);
                            switches.Add("-f");
                            switches.Add(inputFile);

                            processor.StartProcessing(switches.ToArray(), null);
                        }
                    });

                    if (!task.Wait(TimeSpan.FromSeconds(Int32.Parse(ConfigurationManager.AppSettings["MAX_PRINTER_DELAY"]))))
                    {
                        Log.Info(String.Format("A impressão do arquivo ({0}) ({1}) foi encerrada porque ultrapassou MAX_PRINTER_DELAY = {2}!", inputFile, printerNAME, ConfigurationManager.AppSettings["MAX_PRINTER_DELAY"]));
                    }

                }
                catch (GhostscriptLibraryNotInstalledException e)
                {
                    Log.Info("O GhostScript não está instalado.");
                    Log.Error(e);
                }
                catch (GhostscriptException e)
                {
                    Log.Info("O GhostScript apresentou erro.");
                    Log.Error(e);
                }
                catch (Exception exception)
                {
                    Log.Error(exception);
                }

I am using Ghostscript.NET version 1.2.1.0.

Can someone help me?

@jhabjan @tilgovi @MrAntix

@iMoppel
Copy link

iMoppel commented Feb 12, 2019

Has the impersonating user rights to print to the network printer?

@jhabjan
Copy link
Contributor

jhabjan commented Feb 4, 2021

Fixed in today's v.1.2.2. release.

@jhabjan jhabjan closed this as completed Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants