Solved

How to print PDF directly to printer in ASP.NET

Posted on 2004-08-05
6
959 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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