0

I have a Winforms application that has suddenly begun to incorrectly render RDLCs to both physical printers and Print To PDF. It is targeting .NET 4.5.2 and began to show this after an update to 4.7.2 last week. I am able to reproduce the issue on my testbed system as well.

Examples:

Correctly printed:

Correctly Printed

Incorrectly printed:

Incorrectly Printed

I am rendering the RDLC into a MemoryStream and passing that to a PrintDocument.

I've changed the DPI of the PrintDocument and tried different Fonts in the RDLC

Any help or a point in the right direction would be great.

EDIT:

        Private Sub Export()
    Dim RL As PageLayout = CType(_RenderLayout, PageLayout)
    Dim deviceInfo As String = RL.GetDeviceInfo
    Dim warnings() As Warning = Nothing
    _streams = New List(Of Stream)()

    _report.Render("Image", deviceInfo, AddressOf CreateStream, warnings)

    Dim exportStream As Stream
    For Each exportStream In _streams
        exportStream.Position = 0
    Next
End Sub

Private Function CreateStream(ByVal name As String, ByVal fileNameExtension As String, ByVal encoding As Encoding,
 ByVal mimeType As String, ByVal willSeek As Boolean) As Stream
    Dim stream As Stream = New MemoryStream
    _streams.Add(stream)
    _streamCount += 1
    Return stream
End Function

Private Sub PrintPage(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
        Dim pageImage As New Metafile(_streams(_currentPageIndex))
    ev.Graphics.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
    ev.Graphics.DrawImage(pageImage, ev.PageBounds)
    _currentPageIndex += 1
    ev.HasMorePages = (_currentPageIndex < _streams.Count) 

End Sub

0 Answers0