我有一个图像,我试图打印到法律的尺寸。然而,对此有一些挑战。
- The image will vary in size. This is because I m using a control that has limited print options but can export to an image.
- I want to maximize the print area on the page. Smallest margin possible
- The user needs to be able to select a printer and set options
这里我使用的代码是:
PrintDocument pd = new PrintDocument();
pd.PrintPage += (sender, args) =>
{
Image i = Image.FromFile(Globals.TempDirectory + @" emp.jpg");
Point p = new Point(100, 100);
Margins margins = new Margins(50, 50, 50, 50);
pd.DefaultPageSettings.Margins = margins;
args.Graphics.DrawImage(i, p);
};
pd.Print();
由于我无法设置边距, 也无法获得正确的打印。 我希望它能合法打印, 但当我打印图像时, 它没有正常旋转, 只是打印到默认的打印机上。 我愿意做任何事来让它工作 。