Solved

How to print PDF directly to printer in ASP.NET

Posted on 2004-08-05
6
932 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 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