打印图像的实际尺寸 [英] Printing real dimensions of an image

查看:150
本文介绍了打印图像的实际尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我想打印一个图片,我生成的我使用以下代码

Hi mates i want to print a picture i generated i use the following code

  Printer.BeginDoc;
  Printer.Canvas.Draw(0,0,img1.Picture.Bitmap);
  Printer.EndDoc;

它的作品,但它打印的图像非常小如何打印图像的实际大小它出现在屏幕上?

It works but the image it prints is very small how can i print the actual size of the image as it appears on the screen ?

非常感谢。

推荐答案

您可以致电 Canvas.StretchDraw() 。但是,为了取得成果而不能令人印象深刻。尝试以这种方式缩放光栅图像将导致非常多的结果。矢量图像是您需要的,以便能够扩展到打印机分辨率。

You can call Canvas.StretchDraw() instead. However, be prepared for the results to be less than impressive. Trying to scale a raster image in this way will lead to very blocky results. Vector images are what you need in order to be able to scale to printer resolutions.

var
  Scale: Integer;
...
Scale := Min(
  Printer.PageWidth div Bitmap.Width,
  Printer.PageHeight div Bitmap.Height
);
Printer.Canvas.StretchDraw(
  Rect(0, 0, Bitmap.Width*Scale, Bitmap.Height*Scale), 
  Bitmap
);

我在此处选择的缩放比例将保留纵横比,并在打印时使图像尽可能大。

The scaling I chose here will preserve the aspect ratio and make the image as large as possible when printed.

这篇关于打印图像的实际尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆