No announcement yet.

Windows Server 2012 R2 is preventing .NET Application print the file?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Windows Server 2012 R2 is preventing .NET Application print the file?

    I'm going through both scenarios:

    I have a C# .NET Framework ASP.NET Rest API which saves a PDF file to the disk and sends it to Printer.
    • Locally, logged directly in Windows 10 64-Bit, getting succesful using Ghostscript 9.22 for Windows 32-Bit Driver and library, sending a file to Network Printer and out of Network using AcrobatReader as a PDF file sender to the default printer.

    Sending TXT file to the shared Printer at Network, the file is printed. At this point using C# code that call printer without Third Party libraries:
    System.IO.File.Copy(filePath, "\\" + printerIP + "" + printerName);
    • Remotely, connecting to remote Windows Server 2012 R2 Machine using TeamViewer, failed in each: using Ghostscript, the API loops indefinitely and don't responses my API Call. Using Acrobat Reader, the application behavior is correct (the process starts and wait for 10 seconds which is reasonable to print a file), without loops or application exceptions, but doesn't print the file.

    Testing in Windows Server 2012 R2, targeting the real scenario of API Application which is called from a Tablet, remotely scenario is observed too.

    I noted the Acrobat Reader not open the file as happened in success scenario locally, using Windows 10.

    For the purpose, I disabled the Firewall and Antivirus to facilitate the analysis.

    At this moment I am searching for considerations to solve this problem, trying to make the printing PDF File work in Windows Server 2012 R2.

    Can anyone help me?
    Last edited by TarcisioTh; 24th December 2017, 14:56.

  • #2
    Have you installed .Net 3.5??


    • #3
      Yes, i have installed .Net 3.5.


      • #4
        The Microsoft Windows Security Architecture seems not allows Asp Net API to access COM devices as a Printer directly, without the use of Impersonation. Through using Third Party libraries and a local printer connected to Computer with a higher level of intranet user as IIS User, the system printed the file. The best answer ( source code implementation, in my opinion, clearly and reusable without great "refactory effort" at the point of my need ) was obtained developing a Windows Service Program (installed as Admin user which have access to COM devices) that watches a directory and sends your content to the printer using another program as Adobe Reader. The target Printer for my real scenario was an IP Printer, not a local Printer.
        Last edited by TarcisioTh; 9th February 2018, 02:05.


        • #5
 works perfectly for me.

          Best regards

          Addison Ervis