Home > Software engineering >  Setting a custom printer dpi
Setting a custom printer dpi

Time:10-20

I'm still stuck with this USB printer I have. The printer supports a print resolution of 203 dpi, but C# seems to be wanting to print it at 100, because the text is always so incredibly blurry.

How can I change the dpi in which the image and text is printed? I've read the Microsoft Documentation for the Printresolution class object, but it never really stated how to set a custom value. Can anyone help m with that?

CodePudding user response:

Apparently the link just provide the resolutions the printer supports. You have to loop overs PrinterResolutions to know exactly the PrinterResolution your printer supports.

But if the PrinterResolutionKind.High doesn't output what you expect and that you still find the result blurry, you may provide a custom resolution.

If the printer supports the PrinterResolutionKind.Custom then you can provide X and Y properties on the PrinterResolution to define the 'dot per inch'. Values should probably be the same for X and Y, but I don't know. In your case select the PrinterResolution which has the PrinterResolutionKind.Custom and set X and Y values to 203.

Then you have to combine all the settings for the page you want to print. I don't have tested, this is what I understand from the documentation.

CodePudding user response:

If you are directly writing to the printer DC, it uses the resolution of the printer. The 1/100in units are just the drawing units. Your problem is likely dithering. To avoid it, use one of the device fonts, download the desired font to the printer, or disable dithering:

enter image description here

  • Related