Mainiac007


The code below is a class file done in vb.net. The original idea came from reading this forum and some blogs.

To use the code below, you can create a windows application or service.

then create a class file and drop this code in it.

Remeber to reference the 2005 report execution service and also in the program settings include the path to your server.

IE: ReportExecutionService = http://localhost/ReportServer/ReportExecution2005.asmx or whatever your server URL is at.

Setup the public properties for printername (sharenames work fine), Number of copies and Report name.

That is all there is to it. This code is REALLY expandable to add more options.

Please remember to let me kow if you like this.

Imports System

Imports System.Drawing

Imports System.Drawing.Imaging

Imports System.Drawing.Printing

Imports System.IO

Imports System.Web.Services.Protocols

Imports PrintReport.ReportExecution

Imports System.Runtime.InteropServices ' For Marshal.Copy

Namespace PrintReport

Friend Class app

Private m_sPrinterName As String

Private m_sReportName As String

Private m_sNumCopies As Integer

<STAThread()> _

Public Sub Main(ByVal args As String())

Dim pe As PrintMain = New PrintMain()

pe.PrintReport(m_sPrinterName, m_sReportName, m_sNumCopies)

End Sub

Public Property pPrinterName()

Get

Return m_sPrinterName

End Get

Set(ByVal value)

m_sPrinterName = value

End Set

End Property

Public Property pReportName()

Get

Return m_sReportName

End Get

Set(ByVal value)

m_sReportName = value

End Set

End Property

Public Property pNumCopies()

Get

Return m_sNumCopies

End Get

Set(ByVal value)

m_sNumCopies = value

End Set

End Property

End Class

Friend Class PrintMain

Private rs As New ReportExecutionService()

Private m_renderedReport As Byte()()

Private m_delegate As Graphics.EnumerateMetafileProc = Nothing

Private m_currentPageStream As MemoryStream

Private m_metafile As Metafile = Nothing

Private m_numberOfPages As Integer

Private m_currentPrintingPage As Integer

Private m_lastPrintingPage As Integer

Public Sub New()

' Create proxy object and authenticate

rs.Credentials = System.Net.CredentialCache.DefaultCredentials

rs.Url = My.Settings.ReportExecutionService '"http://localhost/ReportServer/ReportExecution2005.asmx"

End Sub

Public Function RenderReport(ByVal reportPath As String) As Byte()()

' Private variables for rendering

Dim deviceInfo As String

Dim format As String = "IMAGE"

Dim firstPage As Byte() = Nothing

Dim encoding As String = ""

Dim mimeType As String = ""

Dim warnings As Warning() = Nothing

Dim reportHistoryParameters As ParameterValue() = Nothing

Dim streamIDs As String() = Nothing

Dim pages As Byte()() = Nothing

Dim historyID As String = Nothing

Dim showHideToggle As String = Nothing

Dim execInfo As New ExecutionInfo

Dim execHeader As New ExecutionHeader()

Dim SessionId As String

Dim extension As String = ""

rs.ExecutionHeaderValue = execHeader

execInfo = rs.LoadReport(reportPath, historyID)

'rs.SetExecutionParameters(parameters, "en-us")

SessionId = rs.ExecutionHeaderValue.ExecutionID

' Build device info based on the start page

deviceInfo = String.Format("<DeviceInfo><OutputFormat>{0}</OutputFormat></DeviceInfo>", "emf")

'Exectute the report and get page count.

Try

' Renders the first page of the report and returns streamIDs for

' subsequent pages

firstPage = rs.Render(format, deviceInfo, extension, encoding, mimeType, warnings, streamIDs)

' The total number of pages of the report is 1 + the streamIDs

m_numberOfPages = streamIDs.Length + 1

pages = New Byte(m_numberOfPages - 1)() {}

' The first page was already rendered

pages(0) = firstPage

Dim pageIndex As Integer = 1

Do While pageIndex < m_numberOfPages

' Build device info based on start page

deviceInfo = String.Format("<DeviceInfo><OutputFormat>{0}</OutputFormat><StartPage>{1}</StartPage></DeviceInfo>", "emf", pageIndex + 1)

pages(pageIndex) = rs.Render(format, deviceInfo, extension, encoding, mimeType, warnings, streamIDs)

pageIndex += 1

Loop

Catch ex As SoapException

'Console.WriteLine(ex.Detail.InnerXml)

Catch ex As Exception

'Console.WriteLine(ex.Message)

Finally

'Console.WriteLine("Number of pages: {0}", pages.Length)

End Try

Return pages

End Function

Public Function PrintReport(ByVal printerName As String, ByVal ReportName As String, Optional ByVal NumCopies As Integer = 0) As Boolean

Me.RenderedReport = Me.RenderReport(ReportName)

Try

' Wait for the report to completely render.

If m_numberOfPages < 1 Then

Return False

End If

Dim printerSettings As PrinterSettings = New PrinterSettings()

printerSettings.MaximumPage = m_numberOfPages

printerSettings.MinimumPage = 1

printerSettings.PrintRange = PrintRange.SomePages

printerSettings.FromPage = 1

printerSettings.ToPage = m_numberOfPages

printerSettings.Copies = NumCopies

printerSettings.PrinterName = printerName

Dim pd As PrintDocument = New PrintDocument()

m_currentPrintingPage = 1

m_lastPrintingPage = m_numberOfPages

pd.PrinterSettings = printerSettings

' Print report

'Console.WriteLine("Printing report...")

AddHandler pd.PrintPage, AddressOf pd_PrintPage

pd.Print()

Catch ex As Exception

'Console.WriteLine(ex.Message)

Finally

' Clean up goes here.

End Try

Return True

End Function

Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As PrintPageEventArgs)

ev.HasMorePages = False

If m_currentPrintingPage <= m_lastPrintingPage AndAlso MoveToPage(m_currentPrintingPage) Then

' Draw the page

ReportDrawPage(ev.Graphics)

' If the next page is less than or equal to the last page,

' print another page.

If m_currentPrintingPage <= m_lastPrintingPage Then

m_currentPrintingPage += 1

ev.HasMorePages = True

End If

End If

End Sub

' Method to draw the current emf memory stream

Private Sub ReportDrawPage(ByVal g As Graphics)

If Nothing Is m_currentPageStream OrElse 0 = m_currentPageStream.Length OrElse Nothing Is m_metafile Then

Return

End If

SyncLock Me

' Set the metafile delegate.

Dim width As Integer = m_metafile.Width

Dim height As Integer = m_metafile.Height

m_delegate = New Graphics.EnumerateMetafileProc(AddressOf MetafileCallback)

' Draw in the rectangle

Dim destPoint As Point = New Point(0, 0)

g.EnumerateMetafile(m_metafile, destPoint, m_delegate)

' Clean up

m_delegate = Nothing

End SyncLock

End Sub

Private Function MoveToPage(ByVal page As Int32) As Boolean

' Check to make sure that the current page exists in

' the array list

If Nothing Is Me.RenderedReport(m_currentPrintingPage - 1) Then

Return False

End If

' Set current page stream equal to the rendered page

m_currentPageStream = New MemoryStream(Me.RenderedReport(m_currentPrintingPage - 1))

' Set its postion to start.

m_currentPageStream.Position = 0

' Initialize the metafile

If Not Nothing Is m_metafile Then

m_metafile.Dispose()

m_metafile = Nothing

End If

' Load the metafile image for this page

m_metafile = New Metafile(CType(m_currentPageStream, Stream))

Return True

End Function

Private Function MetafileCallback(ByVal recordType As EmfPlusRecordType, ByVal flags As Integer, ByVal dataSize As Integer, ByVal data As IntPtr, ByVal callbackData As PlayRecordCallback) As Boolean

Dim dataArray As Byte() = Nothing

' Dance around unmanaged code.

If data <> IntPtr.Zero Then

' Copy the unmanaged record to a managed byte buffer

' that can be used by PlayRecord.

dataArray = New Byte(dataSize - 1) {}

Marshal.Copy(data, dataArray, 0, dataSize)

End If

' play the record.

m_metafile.PlayRecord(recordType, flags, dataSize, dataArray)

Return True

End Function

Public Property RenderedReport() As Byte()()

Get

Return m_renderedReport

End Get

Set(ByVal value As Byte()())

m_renderedReport = value

End Set

End Property

End Class

end namespace




Re: HOW TO: Print a report directly to a printer

Mainiac007


After posting this yesterday. I found some problems with the code.

This works great if your report is 8.5x11, but it still lacks features for printing landscape. I am working on a better solution.

This all started from the need to send a reportname, a parameter, a printer name and number of copies to a program that would render and print a SSRS report. (Trying to replace a cludgy Crystal solution). Part of this goal is to avoid any UI and run this as a service on a report server, not to be confused with a sql reports server. So if anyone has better ideas , please let me know.

Daryl






Re: HOW TO: Print a report directly to a printer

Mainiac007

OKay, I made some modifications to the whole class.

This prints reports beautifully.

Pass in parameters you want and it prints eihter in landscape or portrait.

here is the code..

Imports System.Drawing.Imaging

Imports System.Drawing.Printing

Imports System.IO

Imports System.Web.Services.Protocols

Imports PrintReport.ReportExecution

Imports System.Runtime.InteropServices ' For Marshal.Copy

Imports Rockwood 'Custom object

Imports Microsoft.reportingservices.Interfaces

Namespace PrintReport

#Region "Main"

Friend Class Main

Private m_sPrinterName As String

Private m_sReportName As String

Private m_sNumCopies As Integer

Private m_aParam As ParamsDictionary

Private m_bPrintOrient As String

<STAThread()> _

Public Sub Main(ByVal args As String())

Dim pe As PrintMain = New PrintMain()

pe.PrintReport(m_sPrinterName, m_sReportName, m_bPrintOrient, m_sNumCopies, m_aParam)

End Sub

Public Property pPrintOrient() As Boolean

Get

Return m_bPrintOrient

End Get

Set(ByVal value As Boolean)

m_bPrintOrient = value

End Set

End Property

Public Property pPrinterName() As String

Get

Return m_sPrinterName

End Get

Set(ByVal value As String)

m_sPrinterName = value

End Set

End Property

Public Property pReportName() As String

Get

Return m_sReportName

End Get

Set(ByVal value As String)

m_sReportName = value

End Set

End Property

Public Property pNumCopies() As Integer

Get

Return m_sNumCopies

End Get

Set(ByVal value As Integer)

m_sNumCopies = value

End Set

End Property

Public Property pParam() As ParamsDictionary

Get

Return m_aParam

End Get

Set(ByVal value As ParamsDictionary)

m_aParam = value

End Set

End Property

End Class

#End Region

#Region "PrintMain"

Friend Class PrintMain

Private rs As New ReportExecutionService()

Private m_renderedReport As Byte()()

Private m_delegate As Graphics.EnumerateMetafileProc = Nothing

Private m_currentPageStream As MemoryStream

Private m_metafile As Metafile = Nothing

Private m_numberOfPages As Integer

Private m_currentPrintingPage As Integer

Private m_lastPrintingPage As Integer

Private mGlobals As globals 'Custom logging and error handling

Public Sub New()

mGlobals = New globals

' Create proxy object and authenticate

rs.Credentials = System.Net.CredentialCache.DefaultCredentials

rs.Url = My.Settings.ReportExecutionService

End Sub

Private ReadOnly Property mlog() As LogUtil 'Custom logging and error handling

Get

Return mGlobals.Log

End Get

End Property

Private ReadOnly Property Msgs() As Messages 'Custom logging and error handling

Get

Return mGlobals.erMsg

End Get

End Property

Public Function RenderReport(ByVal reportPath As String, Optional ByVal aParams As ParamsDictionary = Nothing) As Byte()()

' Private variables for rendering

Dim deviceInfo As String

Dim format As String = "IMAGE"

Dim firstPage As Byte() = Nothing

Dim encoding As String = ""

Dim mimeType As String = ""

Dim warnings As Warning() = Nothing

Dim reportHistoryParameters As ParameterValue() = Nothing

Dim streamIDs As String() = Nothing

Dim pages As Byte()() = Nothing

Dim historyID As String = Nothing

Dim showHideToggle As String = Nothing

Dim execInfo As New ExecutionInfo

Dim execHeader As New ExecutionHeader()

Dim SessionId As String

Dim extension As String = ""

Try

mGlobals = New globals 'Custom logging and error handling

mGlobals.appName = My.Application.Info.AssemblyName 'Custom logging and error handling

mGlobals.appVersion = My.Application.Info.Version.ToString 'Custom logging and error handling

rs.ExecutionHeaderValue = execHeader

execInfo = rs.LoadReport(reportPath, historyID)

' Prepare report parameter.

If Not aParams Is Nothing Then

Dim parameters(aParams.Count - 1) As ReportExecution.ParameterValue

Dim i As Integer = 0

For i = 0 To aParams.Count - 1

parameters(i) = New ReportExecution.ParameterValue()

parameters(i).Name = aParams(i).Name

parameters(i).Value = aParams(i).Value

Next

rs.SetExecutionParameters(parameters, "en-us")

End If

SessionId = rs.ExecutionHeaderValue.ExecutionID

' Build device info based on the start page

deviceInfo = String.Format("<DeviceInfo><OutputFormat>{0}</OutputFormat></DeviceInfo>", "emf")

'Exectute the report and get page count.

' Renders the first page of the report and returns streamIDs for subsequent pages

firstPage = rs.Render(format, deviceInfo, extension, encoding, mimeType, warnings, streamIDs)

' The total number of pages of the report is 1 + the streamIDs

m_numberOfPages = streamIDs.Length + 1

pages = New Byte(m_numberOfPages - 1)() {}

' The first page was already rendered

pages(0) = firstPage

Dim pageIndex As Integer = 1

Do While pageIndex < m_numberOfPages

' Build device info based on start page

deviceInfo = String.Format("<DeviceInfo><OutputFormat>{0}</OutputFormat><StartPage>{1}</StartPage></DeviceInfo>", "emf", pageIndex + 1)

pages(pageIndex) = rs.Render(format, deviceInfo, extension, encoding, mimeType, warnings, streamIDs)

pageIndex += 1

Loop

Catch ex As SoapException

Msgs.appendException(ex) 'Custom logging and error handling

Catch ex As Exception

Msgs.appendException(ex) 'Custom logging and error handling

Finally

Msgs.writeMessagesToLog(True) 'Custom logging and error handling

End Try

Return pages

End Function

Public Function PrintReport(ByVal printerName As String, ByVal ReportName As String, ByVal PrintOrient As Boolean, Optional ByVal NumCopies As Integer = 0, Optional ByVal aParam As ParamsDictionary = Nothing) As Boolean

Me.RenderedReport = Me.RenderReport(ReportName, aParam)

Try

' Wait for the report to completely render.

If m_numberOfPages < 1 Then

Return False

End If

Dim pageSettings As System.Drawing.Printing.PageSettings = New System.Drawing.Printing.PageSettings

pageSettings.Landscape = PrintOrient

pageSettings.Margins.Bottom = 0

pageSettings.Margins.Top = 0

pageSettings.Margins.Left = 0

pageSettings.Margins.Right = 0

Dim printerSettings As PrinterSettings = New PrinterSettings()

printerSettings.MaximumPage = m_numberOfPages

printerSettings.MinimumPage = 1

printerSettings.PrintRange = PrintRange.SomePages

printerSettings.FromPage = 1

printerSettings.ToPage = m_numberOfPages

printerSettings.Copies = NumCopies

printerSettings.PrinterName = printerName

Dim pd As PrintDocument = New PrintDocument()

m_currentPrintingPage = 1

m_lastPrintingPage = m_numberOfPages

pd.DefaultPageSettings = pageSettings

pd.PrinterSettings = printerSettings

' Print report

AddHandler pd.PrintPage, AddressOf pd_PrintPage

pd.Print()

Msgs.addInfo("Report: '{0}' on printer : '{1}' for '{2}' copies completed successfully ", ReportName, printerName, NumCopies) 'Custom logging and error handling

Catch ex As Exception

Msgs.appendException(ex) 'Custom logging and error handling

Finally

Msgs.writeMessagesToLog(True) 'Custom logging and error handling

End Try

Return True

End Function

Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As PrintPageEventArgs)

ev.HasMorePages = False

If m_currentPrintingPage <= m_lastPrintingPage AndAlso MoveToPage(m_currentPrintingPage) Then

' Draw the page

ReportDrawPage(ev.Graphics)

' If the next page is less than the last page, print another page.

If m_currentPrintingPage < m_lastPrintingPage Then

m_currentPrintingPage += 1

ev.HasMorePages = True

End If

End If

End Sub

' Method to draw the current emf memory stream

Private Sub ReportDrawPage(ByVal g As Graphics)

If Nothing Is m_currentPageStream OrElse 0 = m_currentPageStream.Length OrElse Nothing Is m_metafile Then

Return

End If

SyncLock Me

' Set the metafile delegate.

Dim width As Integer = m_metafile.Width

Dim height As Integer = m_metafile.Height

m_delegate = New Graphics.EnumerateMetafileProc(AddressOf MetafileCallback)

' Draw in the rectangle

Dim points(2) As Point

points(0) = New Point(0, 0)

points(1) = New Point(width, 0)

points(2) = New Point(0, height)

g.EnumerateMetafile(m_metafile, points, m_delegate)

m_delegate = Nothing

End SyncLock

End Sub

Private Function MoveToPage(ByVal page As Int32) As Boolean

' Check to make sure that the current page exists in the array list

If Nothing Is Me.RenderedReport(m_currentPrintingPage - 1) Then

Return False

End If

' Set current page stream equal to the rendered page

m_currentPageStream = New MemoryStream(Me.RenderedReport(m_currentPrintingPage - 1))

' Set its postion to start.

m_currentPageStream.Position = 0

' Initialize the metafile

If Not Nothing Is m_metafile Then

m_metafile.Dispose()

m_metafile = Nothing

End If

' Load the metafile image for this page

m_metafile = New Metafile(CType(m_currentPageStream, Stream))

Return True

End Function

Private Function MetafileCallback(ByVal recordType As EmfPlusRecordType, ByVal flags As Integer, ByVal dataSize As Integer, ByVal data As IntPtr, ByVal callbackData As PlayRecordCallback) As Boolean

Dim dataArray As Byte() = Nothing

' Dance around unmanaged code.

If data <> IntPtr.Zero Then

' Copy the unmanaged record to a managed byte buffer that can be used by PlayRecord.

dataArray = New Byte(dataSize - 1) {}

Marshal.Copy(data, dataArray, 0, dataSize)

End If

' play the record.

m_metafile.PlayRecord(recordType, flags, dataSize, dataArray)

Return True

End Function

Public Property RenderedReport() As Byte()()

Get

Return m_renderedReport

End Get

Set(ByVal value As Byte()())

m_renderedReport = value

End Set

End Property

Protected Overrides Sub Finalize()

MyBase.Finalize()

End Sub

End Class

#End Region

#Region "Parameters Section 2 classes"

#Region "Params Class"

Public Class Params

Private mID As Integer

Private mName As String

Private mValue As String

Public Sub New(ByVal id As Integer, ByVal name As String, ByVal value As String)

mID = id

mName = name

mValue = value

End Sub

Public Property ID() As Integer

Get

Return mID

End Get

Set(ByVal Value As Integer)

mID = Value

End Set

End Property

Public Property Name() As String

Get

Return mName

End Get

Set(ByVal Value As String)

mName = Value

End Set

End Property

Public Property Value() As String

Get

Return mValue

End Get

Set(ByVal Value As String)

mValue = Value

End Set

End Property

End Class

#End Region

#Region "Dictionary Class"

Public Class ParamsDictionary

Inherits DictionaryBase

Public Sub Add(ByVal param As Params)

MyBase.Dictionary.Add(param.ID, param)

End Sub

Public Sub Add(ByVal id As Integer, ByVal name As String, _

ByVal value As String)

MyBase.Dictionary.Add(id, New Params(id, name, value))

End Sub

Public Sub Remove(ByVal id As Integer)

MyBase.Dictionary.Remove(id)

End Sub

Public Sub Remove(ByVal param As Params)

MyBase.Dictionary.Remove(param.ID)

End Sub

Public Function Contains(ByVal param As Params) As Boolean

Return MyBase.Dictionary.Contains(param.ID)

End Function

Public Function Contains(ByVal id As Integer) As Boolean

Return MyBase.Dictionary.Contains(id)

End Function

Default Public Property Item(ByVal id As Integer) As Params

Get

Return MyBase.Dictionary.Item(id)

End Get

Set(ByVal Value As Params)

MyBase.Dictionary.Item(id) = Value

End Set

End Property

Protected Overrides Sub Finalize()

MyBase.Finalize()

End Sub

End Class

#End Region

#End Region

End Namespace

here is a sample form code to get it going.

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

txtRName.Text = "/Com/ElectronicInvoice" 'test default

txtPrintPath.Text = "\\path\laserjet1150" 'test default

txtNumCopies.Text = 1 ' default

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim oPrint As PrintReport.Main = New PrintReport.Main

Dim args() As String

oPrint.pPrinterName = txtPrintPath.Text.ToString

oPrint.pNumCopies = CInt(txtNumCopies.Text)

oPrint.pReportName = txtRName.Text.ToString

Dim oParams As PrintReport.ParamsDictionary = New PrintReport.ParamsDictionary

oParams.Add(0, "InvoiceNumber", "S0606430")

'add as many paramters as you want or None at all.

oPrint.pParam = oParams

oPrint.pPrintOrient = True 'landscape = true

oPrint.Main(args)

End Sub






Re: HOW TO: Print a report directly to a printer

rpng123

Greetings,

I tried out your printing class (VB2005). I had a problem making the required reference(s). But I was able to do a version of it with the printdocument object. One problem I was having was printing landscape. But your code did show the defaultPagesettings property of the printdocument object - which is what I needed. Now I can print landscape, but your class seems better than the routine I slapped together.

May I request if you could direct me to a link where I could download a zip copy of your print project (or email if you prefer )

Thanks






Re: HOW TO: Print a report directly to a printer

FrederikSmit

Moin Maniac!
Appreciate very much your posting of this sub!!
I extended it for settings of PaperSources, Duplex and so on (note to make settings for PaperSource of FirstPage separately). Unfortunately, I'm in a hurry and extended it in a bad manner. As soon as I find some tome for dealing with it again, I will clean it up and post back if someone's interested.
You can omit the PrintRange and just set to Range.AllPages, and additionally set the pd.Documentname for managing the appearance of the item in the PrinterQueue.
So far
Frederik




Re: HOW TO: Print a report directly to a printer

rfsmason

Hi Frederik, would be keen to see your altered version of this if or when you've had a chance to tidy it up. Any chance you could link to a zipped project for better understand-ability for us novices

Many thanks in advance,

Rob





Re: HOW TO: Print a report directly to a printer

Crimpy

Nice, but I don't see it working from a Service.

According to Microsoft "Classes within the System.Drawing.Printing namespace are not supported for use within a Windows service or ASP.NET application or service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions"

This basically goes for everything of the System.Drawing namespace.

The only thing you're left to use then is API functions (GDI, GDI+). I'm finding out that these aren't that friendly to use.





Re: HOW TO: Print a report directly to a printer

Jack.NET

I have an ASP.NET app that prints using System.Drawing.Printing calls, and I haven't had any problem. True, it may not be an officially supported Microsoft scenario (i.e., they did not do extensive testing in service scenarios). But it certainly does work just fine.




Re: HOW TO: Print a report directly to a printer

Hummer

I am programming in VB using Visual Studio and we need to print directly to a printer without using the report viewer or having to go through a Printer dialogue box.

You say:

Remeber to reference the 2005 report execution service and also in the program settings include the path to your server.

IE: ReportExecutionService = http://localhost/ReportServer/ReportExecution2005.asmx or whatever your server URL is at.

Setup the public properties for printername (sharenames work fine), Number of copies and Report name.

I am able to create a Web refernce, but how do you do create the link for the ReportExecutionService and set up properties for printer names, number of copies and report name

Can you help with this

Thanks

Bob






Re: HOW TO: Print a report directly to a printer

Terry Voss

I just verified that the above code works in ASP.NET with almost no changes.
my.application namespace doesn't exist in web, small things like that.


Terry Voss






Re: HOW TO: Print a report directly to a printer

Mainiac007

you need to create and add a web reference.





Re: HOW TO: Print a report directly to a printer

Jadeja Pradyumansinh (M.E.Comput

Dear,

I have tried same code in c#, it is working properly and report is rendered and priented from printer, but I am facing another problem is formatting problem, priented report fonts are become big and spacing between words and lines are increased automatically and also if the width of the report is greater then 8.5 then it is cutoff the lines






Re: HOW TO: Print a report directly to a printer

jopol_7

If I use this code in a client-server environment, say a user (client) requested for a report...

  1. Is the print request triggered from the browser/server (i.e. will the report print in the local printer)
  2. Or was it processed like a simple print request from the browser
Thanks very much!




Re: HOW TO: Print a report directly to a printer

Mainiac007

I use the class as a vb.net DLL.

So wherever your application is, include the class in your program.

The printing and all other requestes are made from your program calling the class.

Since this is a DLL, it can be put pretty much anywhere you want.





Re: HOW TO: Print a report directly to a printer

jopol_7

Pardon my ignorance, but in that case, will the report print in the local print Thanks very much!