12

I have a Silverlight 5 OOB application (with Elevated Permissions) that's just been deployed to a number of our users. Some of these users are reporting that prints are coming out blank or very faint. These printers do print Word documents correctly and I am unable to reproduce the problem on my own printers.

All users are on Windows XP SP3 32 bit, and I am developing on Win7 64 bit.

As anyone seen this issue before? Or any idea what could be causing this?

Help much appreciated.

Many Thanks, Andrew

slugster
  • 49,403
  • 14
  • 95
  • 145
Andrew Winn
  • 121
  • 3
  • What is your reporting engine? Is there any 3rd party Telerik,Devart etc.What about On preview is it well ? We havent faced off,but thanks for your share. – Davut Gürbüz May 10 '12 at 10:18
  • The page being printed has standard controls. We believe it is a printer driver issue. – Andrew Winn May 10 '12 at 13:18
  • 1
    So what about when you print to XPS printer,or virtual PDF printers.If they are ok,it might be a driver problem. – Davut Gürbüz May 11 '12 at 06:36
  • I have seen this issue, it's driver related. We have a network printer in office which print's correctly from my PC but incorrectly from other PC's depending on OS\Printer driver. – Alex Burtsev Jun 05 '12 at 14:06
  • 1
    are you familiar with the PostScript support needed for Silverlight5 and the fallback? http://10rem.net/blog/2011/06/11/silverlight-5-vector-and-bitmap-printing-for-reports-and-more – Shawn Kendrot Aug 22 '12 at 23:33

1 Answers1

1

I Should Got Solution May Be useFull To You.............................

First i created a new PrintDocument, and hooked up some handlers for its PrintPage event.

mobjPrintDocument = New PrintDocument
RemoveHandler mobjPrintDocument.PrintPage, AddressOf Print_Report
AddHandler mobjPrintDocument.PrintPage, AddressOf Print_Report

Then we can call the PrintBitmap function on the PrintDocument whenever you want to print. Here I am doing it when the user clicks the Print button.

Private Sub xbtnPrint_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
    mintPageIndex = 0
    mobjPrintDocument.PrintBitmap(FileName)
  End Sub

Now comes the important part. We can hijack the content targeted by hooking into the PrintPage event (as handled above). I can set the e.PageVisual to any visual xaml element and the PrintBitmap will handle it. Here I use the GetPages function and loop through to make sure I print each page (a pdfviewer element). However, you can point it to any visual element like I said.

Private Sub Print_Report(sender As System.Object, e As PrintPageEventArgs)
    e.PageVisual = xobjReportViewer.GetPages(mintPageIndex)
    mintPageIndex += 1
    e.HasMorePages = mintPageIndex < xobjReportViewer.GetPages.Count
  End Sub

The e.HasMorePages allows you to force the firing of this event until you are finished.

Hope this is helpful to someone. With Silverlight 5 and the Post-Script printer support, alot of printers that have a PostScript emulator may not be compatible, but will also not default to bitmap printing. This workaround fixes that, making printing a little bit more stable in a LOB type application.

Jignesh.Raj
  • 5,776
  • 4
  • 27
  • 56