印出來是空白的,請問該如何指定給我的 A3 PDF呢?
Public Class myform
Private WithEvents pdoc As New Drawing.Printing.PrintDocument
Dim a4Index As Integer = -1
Private Sub myform_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'setup printer
PrintDocument1.PrinterSettings.PrinterName = "HP LaserJet Professional P1106"
'find A4
For i As Integer = 0 To pdoc.PrinterSettings.PaperSizes.Count - 1
If PrintDocument1.PrinterSettings.PaperSizes(i).PaperName = "A5" Then
a4Index = i
Exit For
End If
Next
End Sub
Private Sub PrintDocument1_QueryPageSettings(ByVal sender As Object, ByVal e As Printing.QueryPageSettingsEventArgs) Handles PrintDocument1.QueryPageSettings
'e.PageSettings.PaperSource = Me.pdoc.PrinterSettings.PaperSources(a4Index)
e.PageSettings.PaperSize = Me.pdoc.PrinterSettings.PaperSizes(a4Index)
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
PrintDocument1 = "C:\Users\Administrator\AppData\Local\Temp\1\E.pdf"
'Me.PrintPreviewDialog1.Document = PrintDocument1
'Me.PrintPreviewDialog1.ShowDialog()
Me.PrintDocument1.Print()
End Sub
End Class
既然印表機只能印A4,
基本上應該就不可能會有A3的選項,
最好是買一台A3的印表機,
或是你可以申請到客戶的公司去Debug...
給你一個基本觀念好了。
所謂尺寸最終處理權,永遠來自於輸出端。
PDF你設定A3或是A4。都只是一個標定值。你也可以將其視為預設值的一種宣告。
但任何一台輸出設備(印表機或影印機)。都有改變尺寸的能力(其實講白了,也只是放大縮小)
也就是說,你的程式只要能達到能設定A3尺寸就算大功告成了。
想要叫A4的印表機來印A3!!!!!這是不可能辦到的事的。
一定會強迫縮小印A4了。(雖然可以關掉能式列印出印一半但符合A3的東西出來)