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
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