Daniel Enetoft
Daniel Enetoft

Reputation: 422

Printing text from silverlight application

I'm trying to print a report (just text in columns) from my Silverlight 4 application. The only way I know about is to use PrintDocument and set the PageVisual to a framework element showing the report. However, this results in an insanely large print job (like 120 MB). This is not what my customer wants. Is there any other solution?

Upvotes: 2

Views: 1053

Answers (3)

Keith Adler
Keith Adler

Reputation: 21178

The problem with Silverlight 4 is that everything you go to print is produced as a rasterized image at 600 DPI. This explains the large job size you are seeing. This is also why text from Silverlight can look very fuzzy compared to what you'd expect from your output. Silverlight 5 will address this with Postscript vector-based printing, but for now you are facing the reality that without third-party solutions you are effectively stuck with the out of the box limitations or using HTML.

If you are willing to generate the report from HTML being served server-side you may have the best solution considering what you're doing. In that case you would at least not have to worry about complexities like pagination as part of printing from Silverlight.

A good third-party solution for reporting, but perhaps more than what you need, is to use Reporting Services coupled with this product: http://www.perpetuumsoft.com/Silverlight-Viewer-for-Reporting-Services.aspx?lang=en

Upvotes: 2

obenjiro
obenjiro

Reputation: 3750

You can convert your text into picture and then print picture.. mb this will help you

http://www.andybeaulieu.com/Home/tabid/67/EntryID/161/Default.aspx http://www.snowball.be/Printing+In+Silverlight+3+Yes+We+Can.aspx

Upvotes: -1

jumbo
jumbo

Reputation: 4868

One easy solution is to print web page directly from browser (I assume this is not what you want).

I think the PrintDocument and PageVisual is the only way how to print from inside of SL.

I did some printing even with large visual structures, but I haven't checked how large my print job is, so I can't tell you if it is normal or not.

Anyway, you can try not to print directly the element you want to print, but made some other lightweight one which will serve only for printing purposes and fill it with same data and print that lightweight element.

Upvotes: 1

Related Questions