How to print a pdf file directly to printer(silent printing) without using tools like adobe?

Subash 21 Reputation points
2022-07-18T13:13:55.66+00:00

Hi,

I have an invoice pdf file in my local file system. I need to directly print it without showing any preview or dialog box(silent printing).
Note: Without using tools like adobe reader.

Thanks.

Developer technologies | Windows Presentation Foundation
Developer technologies | C#
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Castorix31 90,686 Reputation points
    2022-07-18T15:58:40.257+00:00

    Without any external tool, one of the ways is with Windows.Data.Pdf (references to Windows.winmd and System.Runtime.WindowsRuntime.dll for WPF or Winforms), by converting each PDF page into an image (I tested with a BitmapImage for example, from PdfPage.RenderToStreamAsync),
    then you can print each image silently on a printer with PrintDialog.PrintVisual or other method

    1 person found this answer helpful.
    0 comments No comments

  2. Bill Reiss 0 Reputation points Microsoft Employee
    2023-12-01T16:46:51.1433333+00:00

    I used FreeSpire.PDF in .NET MAUI on Windows, I don't see any reason why it wouldn't work in WPF. Details here: [http://billreiss.com/2023/12/01/printing-a-pdf-from-net-maui-windows-silently/]

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.