Setting the paper size

后端 未结 5 722
灰色年华
灰色年华 2021-02-14 03:49

Please help me on how to set my paper size in c# code. I am using the API printDocument.

Below is my code:

 ppvw = new PrintPreviewDialog();
 ppvw.Docume         


        
5条回答
  •  执笔经年
    2021-02-14 04:06

    Try this. I think this code will help you to solve this problem.

    Private Sub bt_Save_Click(sender As Object, e As EventArgs) Handles bt_Save.Click
        MsgBox("Saved", MsgBoxStyle.Information)
        If MsgBox("you want to print now?", MsgBoxStyle.Question + vbOKCancel, "Printing") = MsgBoxResult.Ok Then
            Try
                PrintPreviewDialog1.Document = ImportBillPrintDocument
                ImportBillPrintDocument.PrinterSettings.DefaultPageSettings.PaperSize = pkCustomSize1
                ImportBillPrintDocument.DefaultPageSettings.PaperSize = pkCustomSize1
    
                PrintPreviewDialog1.WindowState = FormWindowState.Maximized
                PrintPreviewDialog1.ShowDialog()
            Catch ex As Exception
    
            End Try
    
        End If
    End Sub
    

提交回复
热议问题