printer resolutions 5-6 times greater screen's resolution. printer's resolution can around 6600 x 5100 opposed full hd screen's resolution: 1920 x 1080.
an 1920 x 1080 image looks great on screen avoid pixelation, 1 should ideally render higher resolution image printer, example, 6600 x 5100 image.
i trying print high definition image (6600 x 5100) high definition printer (600 dpi), find available print area 850 x 1100 specified e.pagebounds; see code below:
bitmap bitmaptoprint; public void printimage() { bitmaptoprint = new bitmap(1700,2200); font font = new font(fontfamily.genericsansserif, 60, fontstyle.regular); string alphabet = "abcdefghijklmnopqrstuvwxyz"; graphics graphics = graphics.fromimage(bitmaptoprint); graphics.drawstring(alphabet, font, system.drawing.brushes.black, 0, 0); graphics.drawstring(alphabet, font, system.drawing.brushes.black, 0, 1000); printdocument pd = new printdocument(); pd.printersettings.printername = "microsoft xps document writer"; pd.printersettings.printtofile = true; pd.printpage += new printpageeventhandler(pd_printpage); pd.print(); } void pd_printpage(object sender, printpageeventargs e) { e.graphics.drawimage(bitmaptoprint, new pointf(0, 0)); //have @ e.pagebounds, dimensions 850x1100 } as rogern has pointed out, fix problem, drawimage call must replaced by:
e.graphics.drawimage(bitmaptoprint, new rectanglef(0.0f, 0.0f, 850.0f, 1100.0f));
Comments
Post a Comment