December 29, 2008 at 3:24 pm
For no apparent reason, our SSRS reports that are printed from a .NET program are now printing almost twice as large so the invoice no longer fits on the page. The font is bigger but so is the logo.
Has anyone heard of this? I can't find anything in google or on Microsoft's site. I had submitted this problem to Microsoft but they were unable to fix it. They had me download and install ReportViewer 2005 SP1 on my development machine but that did not fix it.
So then I built another server to run SSRS and made sure that I did NOT install KB954606 because the problem on the first server appeared to start after this update. It has been running fine now for a few weeks. Then, this new server started exhibiting the same bad behavior. Yet no updates have been installed.
We are using SQL 2005 Standard, version 9.00.3042.00.
Any help or ideas are appreciated.
December 29, 2008 at 3:40 pm
Has anything changed in the .NET application? Is the printer the same? Does this happen with all printers? What happens if you access the reports directly using the report server? What happens when you export to PDF?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
December 29, 2008 at 3:57 pm
Has anything changed in the .NET application? Nope.
Is the printer the same? Yes.
Does this happen with all printers? Yes.
What happens if you access the reports directly using the report server? They print just fine. In fact, from within Visual Studio in the report designer, they print fine. It just messes up when printed programmatically.
What happens when you export to PDF? From the report server, they export to PDF just fine. I'm not changing the program to test the export to PDF when executed from the program.
Thanks for asking.
December 29, 2008 at 4:10 pm
How are you calling the report in the .NET application? Is the report previewed first or printed directly?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
December 29, 2008 at 4:37 pm
There is no preview, it just prints the reports directly from the program. Here's the code in my ReportPrinter.vb class:
Imports System.IO
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Drawing.Printing
Imports System.Drawing.Graphics
Imports System.Runtime.InteropServices
Public Class ReportPrinter
Implements IReportPrinter
Private m_currentPrintingPage As Integer = 1
Private m_lastPrintingPage As Integer = 1
Private m_currentPageStream As MemoryStream
Private m_metafile As Metafile
Private m_pages As IList(Of IReportPage)
Private m_delegate As EnumerateMetafileProc = Nothing
Private m_printerName As String = String.Empty
Private m_cancelled As Boolean = False
Private m_printing As Boolean = False
Public WriteOnly Property PrinterName() As String Implements IReportPrinter.PrinterName
Set(ByVal value As String)
If Not String.IsNullOrEmpty(value) Then
m_printerName = value
End If
End Set
End Property
Public Sub Cancel() Implements IReportPrinter.Cancel
If (Not m_printing) Then
Throw New ApplicationException(My.Resources.CannotStopUnstartedPrintJob)
End If
m_cancelled = True
End Sub
Public Sub Print(ByVal pages As System.Collections.Generic.IList(Of IReportPage), _
ByVal landscapeMode As Boolean) Implements IReportPrinter.Print
m_pages = pages
m_currentPrintingPage = 1
m_lastPrintingPage = m_pages.Count
Dim pd As New PrintDocument()
pd.PrinterSettings = Me.GetSettings(m_pages.Count)
pd.DefaultPageSettings.Landscape = landscapeMode
AddHandler pd.PrintPage, AddressOf PrintPage
pd.Print()
End Sub
Private Function GetSettings(ByVal totalPages As Integer) As PrinterSettings
Dim settings As New PrinterSettings
settings.MaximumPage = totalPages
settings.MinimumPage = 1
settings.PrintRange = PrintRange.SomePages
settings.FromPage = 1
settings.ToPage = totalPages
If Not String.IsNullOrEmpty(m_printerName) Then
settings.PrinterName = m_printerName
End If
Return settings
End Function
Private Sub PrintPage(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
ev.HasMorePages = False
ev.Cancel = m_cancelled
If (Not m_cancelled AndAlso _
m_currentPrintingPage <= m_lastPrintingPage AndAlso _
Me.MoveNextPage(m_currentPrintingPage)) Then
Me.DrawPage(ev.Graphics)
'// if the next page is not the end, specify more pages
m_currentPrintingPage += 1
If (m_currentPrintingPage <= m_lastPrintingPage) Then
ev.HasMorePages = True
End If
End If
End Sub
Private Function MoveNextPage(ByVal page As Integer) As Boolean
Dim pageIndex As Integer = m_currentPrintingPage - 1
'// if the current page does not exist, we can't move forward
If (m_pages(pageIndex) Is Nothing) Then
Return False
End If
'// set the current page stream equal to the rendered page
m_currentPageStream = New MemoryStream(m_pages(pageIndex).Contents)
'// set the position to start
m_currentPageStream.Position = 0
'// initialize metafile
If (m_metafile IsNot Nothing) 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 Sub DrawPage(ByVal g As Graphics)
'// check to ensure there is a page to draw
If (m_currentPageStream Is Nothing OrElse _
m_currentPageStream.Length = 0 OrElse _
m_metafile Is Nothing) 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 EnumerateMetafileProc(AddressOf MetafileCallback)
'// draw 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 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
'// convert from unmanaged objects to managed objects
If (data <> IntPtr.Zero) Then
'// copy unmanaged record to managed byte buffer that can
'// be used by playrecord
ReDim dataArray(dataSize)
Marshal.Copy(data, dataArray, 0, dataSize)
End If
'// play the record
m_metafile.PlayRecord(recordType, flags, dataSize, dataArray)
Return True
End Function
End Class
December 29, 2008 at 4:55 pm
It sounds like there has been some change to printer settings and that the problem is on the .NET side and not the Reporting Services side, since the report is printing fine using reporting services.
I'm not a .NET expert, so I don't know where to go from here. Wish I could be of more help.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
December 29, 2008 at 5:00 pm
Thanks anyways for taking an interest.
June 3, 2010 at 2:19 pm
Has anyone else seen this issue before?
I have a report that is printing out much larger on some printers than others, and is cutting off part of the report.
June 3, 2010 at 2:35 pm
I was not able to get this problem resolved. I got Microsoft Support involved and eventually they refunded my money because they couldn't help me either.
So good luck.
June 3, 2010 at 3:12 pm
I've made a slight breakthrough.
Through testing we have realized that the report's size is directly related to the screen resolution the user is running at.
Switching to various resolutions resulted in the font on the print out to change size (the zoom effect described above.)
Next step is to look at solving this issue through code...
Viewing 10 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply