dcme
dcme

Reputation: 27

Windows "Print" process verb ignores my default printer argument

I have adobe installed and it opens a PDF fine. I am trying to get a PDF to print to a specific printer (not my default printer) from my vb.net program - and it isn't working.

Dim p As New System.Diagnostics.ProcessStartInfo
p.Verb = "print"
p.Arguments = "Brother HL-2270DW series"
p.FileName = xfile
p.UseShellExecute = True
p.CreateNoWindow = True
p.WindowStyle = ProcessWindowStyle.Hidden

Using xp As System.Diagnostics.Process = System.Diagnostics.Process.Start(p)

      xp.WaitForExit(10000)
      xp.Close()
end using

Instead, it opens adobe with the document and wants to print to my default printer (which is the XPS document writer).

Upvotes: 0

Views: 359

Answers (2)

Sebastian
Sebastian

Reputation: 69

I found a workaround that might help others. It was happening to us in Windows 10 with an old VB 6.0 program: regardless which printer was selected it was always coming out from the default one. To solve this we had to uncheck the "let windows manage my default printer" on the "Printers and Scanners" dialog. After that, VB6.0 program worked correctly.

https://support.microsoft.com/en-us/windows/set-a-default-printer-in-windows-e10cf8b8-e596-b102-bf84-c41022b5036f

Upvotes: 2

dcme
dcme

Reputation: 27

I have found my solution that was quite easy and took about 10 minutes. NuGet package PDFium Viewer (v2.13.0) and the 32bit PDFium.Viewer.Native.x86 (v2018.4.8.256). Works perfectly.

Upvotes: 1

Related Questions