Dim ps As New
PageSettings Dim pDocument as new PrintDocument Dim myPaperSize As System.Drawing.Printing.PaperSize If ps.PrinterSettings.InstalledPrinters.Count > 0 Then '檢測(cè)打印機(jī)是否存在 For Each myPaperSize In ps.PrinterSettings.PaperSizes '檢查該當(dāng)前打印機(jī)是否支持A3的紙張 If myPaperSize.Kind = PaperKind.A3 Then Exit For End If next If myPaperSize.Kind <> PaperKind.A3 Then '如果當(dāng)前打印機(jī)不支持A3紙張,那么自定義A3大小的紙張 myPaperSize = New System.Drawing.Printing.PaperSize("A3", 1169, 1654) End If ps.PaperSize = myPaperSize '設(shè)置為指定的紙張 ps.Landscape = False pDocument.DefaultPageSettings = ps pDocument.PrinterSettings.PrinterName = ps.PrinterSettings.PrinterName End If End If |
|