打印适合页面
我需要打印一个标签以适应页面。 我正在尝试这个,但打印比页面大,宽度和高度似乎太多
private void PrinterPrintPage(object sender, PrintPageEventArgs e)
{
var b = Tasks.Pop();
if (b.Label == null)
b.Label = GetLabelImage(b.Codice, b.ColoreID);
var rect = e.PageBounds;
e.Graphics.DrawImage(b.Label, rect);
e.HasMorePages = Tasks.ContainTasks();
_printedCount++;
}
I need to print a label to fit the page.
I'm tryng this but print big than page, width and height seems to be to much
private void PrinterPrintPage(object sender, PrintPageEventArgs e)
{
var b = Tasks.Pop();
if (b.Label == null)
b.Label = GetLabelImage(b.Codice, b.ColoreID);
var rect = e.PageBounds;
e.Graphics.DrawImage(b.Label, rect);
e.HasMorePages = Tasks.ContainTasks();
_printedCount++;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 有关 PrintPageEventArgs.PageBounds 的 MSDN 文档,
...首先,尝试将
PageBounds
更改为MarginBounds
。如果这没有帮助,请将边界矩形向页面中心“缩小”,以便远离边缘。As per MSDNs documentation on PrintPageEventArgs.PageBounds,
...first of all, try changing
PageBounds
toMarginBounds
. If this doesn't help, "deflate" the bounds rectangle towards the centre of the page so you move away from the edges.