c# - PrintDocument images on 203 dpi require dithering -
i having problem when printing label using printdocument
class. trying print image happens barcode. image generated using code found here.
the problem experiencing when printing image on printer dpi of 203, edge of bars blurry. assume caused dithering on pritner image trying print between 2 of dots on print head.
i have tried scaling barcode before generating image, has no effect.
public void print() { printdocument printdocument = new printdocument { defaultpagesettings = { landscape = label.landscape, papersize = label.papersize }, originatmargins = true, printersettings = { printername = "printername" }, printcontroller = new standardprintcontroller() }; printdocument.printpage += on_printpage; printdocument.print(); } private void on_printpage(object sender, printpageeventargs e) { e.graphics.resettransform(); drawbarcode(_elements[0], e.graphics); } private drawbarcode(ielement labelelement, graphics graphics) { float xtranslate = (labelelement.x/96)*dpi - ((hardmarginx/100)*dpi ); float ytranslate = (labelelement.y/96)*dpi - ((hardmarginy/100)*dpi ); //call baroode library image barcodeimage = labelelement.getbarcodeimage((int) ((labelelement.width/96)*dpi ), (int) ((labelelement.height/96)*dpi )); graphics.translatetransform(xtranslate, ytranslate); graphics.drawimage(barcodeimage, new rectangle(0, 0, barcodeimage.width, barcodeimage.height)); graphics.resettransform(); }
the ielement
object class holds information location , size of element printed on label.
i thought generating size (labelelement.width/96)*dpi
dpi = 203
have solved problem. before change dpi 300 gdi uses units. change has not helped in barcode image clarity , has caused problem elements not appearing should.
is there anyway can print clear images (specifically barcodes) on 203 dpi printer printdocument
class?
thanks
i know stale question- else trips this:
you can access dithertype in win32_printerconfiguration seems read-only.
the easier way go around set dithering none in printer preferences through windows ui.
Comments
Post a Comment