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++;
}
有帮助吗?

解决方案

As per MSDNs documentation on PrintPageEventArgs.PageBounds,

Most printers cannot print at the very edge of the page.

...first of all, try changing PageBounds to MarginBounds. If this doesn't help, "deflate" the bounds rectangle towards the centre of the page so you move away from the edges.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top