在Delphi如何打印jpg文件?
解决方案 »
- image组件只支持BMP格式么
- delphi mshtml 抛异常问题 高手来呀
- 关于地图坐标定位的问题
- ReportBuilder史上无法解决的问题,困扰我5年了
- 求助:自己制作的IE工具栏上的控件的 hint不能自动彻底消失
- 请问如何获取外部程序的一个文本输入框和一个按钮的句柄,窗体句柄已经获得!
- treeview+access 小问题
- 局域网基本问题,,高手帮忙???
- 如何将整型数组转换为字符串?
- 菜鸟接到一个餐饮软件,接串口打印机,其他公司做的软件可以实现监测打印状态,我该怎么做呢??
- 【十万火急:Dbexpress问题】 SQLStoredProc调用oracle *包*中存储过程的问题 报错找不到数据???
- 有没有办法 从中文字符串生成拼音字母的字串? 好老师我会另开贴给分
var
px,py:integer;
rect:trect;
begin
//showmessage(inttostr(screen.PixelsPerInch));
inherited;
try
//获得打印机的分辨率
px:=getdevicecaps(printer.Handle,logpixelsx);
py:=getdevicecaps(printer.Handle,logpixelsy);
//设置图片的打印区域
with rect do
begin
left:=trunc(strtofloat(edit1.Text)/2.54*px);
top:=trunc(strtofloat(edit2.Text)/2.54*py);
right:=trunc(image1.Picture.Width*px*strtofloat(edit3.text)/100)+left;
bottom:=trunc(image1.Picture.Height*py*strtofloat(edit3.text)/100)+top;
end;
//向打印机输出图片
with image1.Picture.Bitmap do
begin
printer.Title:='图片打印';
try
printer.begindoc;
printer.canvas.StretchDraw(rect,image1.Picture.Bitmap);
application.ProcessMessages;
printer.enddoc;
except
printer.Abort;
raise;
end;
end;
except
showmessage('没有打印机,请选择打印机!');
end;
end;