Reputation: 1043
I am taking a screenshot of my app and store it in a bitmap. So far so good. Then I would like to be able to print that bitmap in different resolutions on my standard printer (some users use a network printer and it may take a long while for them to print "high quality" screenshots. The printing as such works, but I have a question about the resolution or rather the quality of the image in the prints.
In order to print I use the PrintDocument.Print
method. In that method I tried to set the PrinterSettings.PrinterResolutions
property to different values, e.g. to PrinterResolutionKind.Low
and to PrinterResolutionKind.High
. I expected to see a difference in the output on our printer, but they both looked the same to me (bulk standard laser printer). Basically I thought that setting to PrinterResolutionKind.Low
would cause lesss network traffic for network printers.
So am I using the right approach? Or would I need to modify the bitmap somehow when printing it with different PrinterResolutionKind
s?
Any help is appreciated.
Upvotes: 1
Views: 484
Reputation: 941665
bulk standard laser printer
You are very unlikely to see a difference on a laser printer, they are vector devices. As opposed to, say, a dot-matrix printer which is a raster device and therefore has a dire need to support multiple print resolutions. Printing graphics on a dot-matrix printer is like watching grass grow.
You have to do this yourself. Rescale the bitmap to a smaller size, easiest done with the Bitmap(Image, int, int) constructor. Then get it rescaled to the original size again by using the e.Graphics.DrawImage(Image, Rectangle) overload in your PrintPage event handler. Or e.Graphics.ScaleTransform(). If the printer driver co-operates (it should) and passes the rescale request to the printer instead of implementing it itself then you'll get a corresponding reduction in print data.
Beware the drastically poorer quality of the output. Screenshots already have a resolution that's 6 times lower than a laser printer so every screen pixel gets turned into a 6x6 blob on paper. You'll make this a lot worse by shrinking the image.
Upvotes: 1
Reputation: 1943
Not all printers drivers support multiple resolutions, so setting the printer resolution to PrinterResolutionKind.Low
may produce the same output as PrinterResolutionKind.High
.
It's also possible that the setting is being applied, but the difference isn't noticeable in the printed output. A better way to check if the setting is resulting in lower bandwidth is to pause the printer and look at the spool file size. If the spool file size is smaller, your change is having the intended effect.
Depending on the printer driver, PrinterResolutionKind.Draft
may produce a smaller spool file than PrinterResolutionKind.Low
.
Also, make sure you're setting the DefaultPageSettings as in:
printDoc.DefaultPageSettings.PrinterResolution = PrinterResolutionKind.Draft
Upvotes: 1