wpf printing with xps – avoiding rasterization

I’ve had a collection of headaches getting printing to work correctly in a wpf app that displays long vertical graphs of geological data.  Paging is one topic Ill cover later (as Im still trying some things to determine which works best), but a recent headache has been apparently random rasterizing of parts of the printout. I normally print using acrobat to a pdf for testing purposes (don’t wanna waste paper!), and I’d noticed that some parts of the graph seem to get rasterized while others stay in vector fomat. You probably already know this but rasterized output will typically not look as good on most printers, plus it can rapidly increase your data size sent to the printer (or pdf). And, if you are using a pdf, you can zoom in on the file when viewing it.. so any rasterized parts will get all jaggie and ugly.

So, my lessons learns so far in avoiding this:

-Dont use opacity settings. So far, I only had opacity levels set for some background fills inside a curve line. This would result in rasterizing both the curve line, fill, and apparently anything drawn behind it- which in my case included the entire background grid.

-(I havent verified this one, but-) dont draw geometry that extends past a clipped edge. For example, my curve lines would draw past the edge of the canvas they were displayed on, and the canvas had clipping turned on. Again, not verified, but i think this was causing rasterization.

– Don’t dump an oversized visual into a page that it doesnt fit in. This is another one I havent confirmed, but it seemed that the longer the data I shoved into a page (and which continued off the end of the page), the more likely some parts wound up growing jaggies.

If I find more, Ill add it here. Now I’m off to figure out efficient ways to chop up my graph into pages.

Advertisements