0

I need to fetch data from SQL through query and generate a PDF and write to it, and wants the application to print that PDF automatically without clicking any button or any other human intervention. furthermore, i need to schedule this application.

Kindly help me if any one who know about automatic printing.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user3407588
  • 1
  • 1
  • 1

1 Answers1

0

OOB print functionality and generation of PDF document support is effectively non-existent in .NET. You have PrintQueue and PrintDocument to print images and text, but PDF support is not there. Similary for WPF's XpsDocument. For a programmatic print I recommend a 3rd party utility such as DynamicPDF). They also have tools to generate PDF documents. SSRS can also generate PDF documents which may be useful since you are already working with SQL (I assume T-SQL since you mentioned .NET).

Adobe has limited support for command line printing. I can tell you by experience that if you want to print via the local machine which has the printer driver installed then it should work. However, if you need to print to a print server it will fail. Support does not exist for command line printing via Adobe and their API as of now also does not support printing.

Command line syntax for adobe: "C:\Program Files (x86)\Adobe\Reader 10.0\Reader\acrord32.exe" /N /T "myPDFfile.pdf" "myprintername"

P.Brian.Mackey
  • 43,228
  • 68
  • 238
  • 348