Solved

How to print PDF directly to printer in ASP.NET

Posted on 2004-08-05
6
923 Views
Last Modified: 2012-06-22
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?
0
Comment
Question by:n0ell
  • 3
6 Comments
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11728843
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11728902
Theres a .NET Library for that as well here:

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

Regards,

Aeros
0
 

Expert Comment

by:ncacnio
ID: 11826350
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
 
LVL 17

Accepted Solution

by:
AerosSaga earned 250 total points
ID: 11827168
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now