Share via

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#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Castorix31 91,871 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' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.