Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PDF printing from .NET application not working when running as Windows service

New Here ,
Apr 20, 2021 Apr 20, 2021

Hi,

 

We're building an application to automatically print PDFs from .NET (C#) code. For this we're basically starting a process on the selected PDF file and specify the 'Print' verb (similar to 'Start-Process -FilePath "path/to/file.pdf" -Verb Print' in Powershell). The code looks roughly like this:

var printProcess = new Process
{
    StartInfo = new ProcessStartInfo
    {
        FileName = "path/to/file.pdf",
        Verb = "Print",
        CreateNoWindow = true,
        UseShellExecute = false,
        WindowStyle = ProcessWindowStyle.Hidden
    }
};

printProcess.Start();

When including this code in a .NET console application and running it on Windows 10 Enterprise, it works just fine and the PDF is sent to the default printer.

 

However, when the same code is included in a application that is then executed as Windows service, nothing seems to happen and no file is sent to the printer. A look into the Event Log reveals the following error:

Faulting application name: AcroRd32.exe, version: 21.1.20145.32109, time stamp: 0x6042feb9
Faulting module name: AcroRd32.exe, version: 21.1.20145.32109, time stamp: 0x6042feb9
Exception code: 0xc0000005
Fault offset: 0x000420b2
Faulting process id: 0x2f84
Faulting application start time: 0x01d735e9daa197da
Faulting application path: C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe
Faulting module path: C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe
Report Id: 0cba9bb9-4766-40ad-b86a-ac34978d7051
Faulting package full name: 
Faulting package-relative application ID: 

 

Does anyone have an idea what this error means or even better, how we can get it working properly?

TOPICS
Crash or freeze , Print , Windows
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 20, 2021 Apr 20, 2021
LATEST

Acrobat Reader is an interactive tool. I wouldn't expect it to work in a Service environment. This use might also be outside the EULA. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines