How to print PDF directly to printer in ASP.NET

What I really need to do is print a report done in SQL Server Reporting Services directly to printer but it doesn't have a print option.  So what I did was export the report to a PDF file then print it directly to a printer.

I had this working before with this code:

        Dim FileName As String = "c:\InetPub\wwwRoot\HSAdminDev\PDFReports\BarCodes.PDF"
        Dim p As New System.Diagnostics.ProcessStartInfo
        p.Verb = "print"
        p.WindowStyle = Diagnostics.ProcessWindowStyle.Hidden
        p.FileName = FileName
        p.UseShellExecute = True
        Try
            System.Diagnostics.Process.Start(p)
        Catch ex As Exception
            PrintSuccessMsg = ex.Message
        End Try

It suddenly stopped working and couldn't get it to work again.  It also opens up a process for adobe acrobat, but nothing happens.

Anyone knows of another method of printing a PDF file directly to printer in ASP.NET?
n0ellAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
AerosSagaConnect With a Mentor Commented:
Dim wrdApp As New Word.Application
    wrdApp.Documents.Open("C:\temp\temp.doc")
    wrdApp.Dialogs.Item(Word.WdWordDialog.wdDialogFilePrint).Show()
    wrdApp.Visible = False
    wrdApp.ActiveDocument.PrintOut = False
    wrdApp.ActiveDocument.Close()
    wrdApp.Quit()

ps this also does pdf
0
 
AerosSagaCommented:
0
 
AerosSagaCommented:
Theres a .NET Library for that as well here:

http://sourceforge.net/projects/report/

Regards,

Aeros
0
 
ncacnioCommented:
Thanks Aeros.

The code was actually working though.  It was printing to a different printer - it just chooses the first printer installed on the server.

0
All Courses

From novice to tech pro — start learning today.