VB.NET打印法律规模

时间:2015-12-09 10:26:18

标签: vb.net printing page-size

此程序拒绝打印合法大小。我花了很多时间研究这个问题而没有运气。帮助将不胜感激。打印机支持Legal打印。 " Imports System.Drawing.Printing"声明在那里。如果我取消注释PrintPreviewDialog块,它将以Legal大小预览,但以正常大小打印。

编辑:程序进一步简化。如果有人可以运行此代码来确定它是程序问题还是别的,我将不胜感激。两台不同的计算机上出现问题,两台打印机都在Excel中每天用于合法打印。

Imports System.Drawing.Printing

Public Class Form1

Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click

    PrintDocument1.DefaultPageSettings.PaperSize = PrintDocument1.PrinterSettings.PaperSizes(2)  '2 has been verified correct, confirmed below


    'PrintDocument1.Print()
    PrintPreviewDialog1.Document = PrintDocument1
    PrintPreviewDialog1.ShowDialog()

End Sub

Private Sub PrintDocument2(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage

    MsgBox(PrintDocument1.DefaultPageSettings.PaperSize.ToString)  ' this verifies the papersize code is correct at run time

    Dim drawFont As New Font("Helvetica", 10)
    Dim rc1 As RectangleF = New RectangleF(250, 650, 400, 50)
    e.Graphics.DrawString("Hello World", drawFont, Brushes.Black, rc1)

End Sub

结束班

0 个答案:

没有答案