c# - PrintDocument just prints some part of my JPG file -
i created application allows users print multiple jpg files. send print request directly, this:
if (existfile == true) { printersettings a=new printersettings(); printdocument pd = new printdocument(); ienumerable<papersize> size = a.papersizes.cast<papersize>(); papersize a4 = size.first<papersize>(i => i.kind == paperkind.a4); pd.defaultpagesettings.landscape = true; pd.defaultpagesettings.papersize = a4; pd.printpage += printpage; pd.print(); }
and print function :
private void printpage(object o, printpageeventargs e) { system.drawing.image img = system.drawing.image.fromfile(currentaddress); point loc = new point(100, 100); e.graphics.drawimage(img, loc); }
but code prints part of image, not of .i want print them scale fit
. how can that?
this might fix issue.
e.graphics.drawimage(img, e.marginbounds);
or
e.graphics.drawimage(img, e.pagebounds);
or
ev.graphics.drawimage(image.fromfile("c:\\my folder\\myfile.bmp"), ev.graphics.visibleclipbounds);
Comments
Post a Comment