Setting the paper size

后端 未结 5 725
灰色年华
灰色年华 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条回答
  •  梦毁少年i
    2021-02-14 04:21

    I am using Visual Basic, with this code I can get the form to show it all in printpreview, still print a slitely cut page on the right.

    PrintForm1.Form = Me
    PrintForm1.PrinterSettings.DefaultPageSettings.Landscape = True
    PrintForm1.PrinterSettings.DefaultPageSettings.PaperSize = New Printing.PaperSize("Custom", Me.Height, (Me.Width + 47))
    PrintForm1.PrinterSettings.DefaultPageSettings.Margins = New Printing.Margins(3, 3, 3, 3)
    PrintForm1.PrinterSettings.DefaultPageSettings.PaperSize.RawKind = Printing.PaperKind.A4Small
    PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview    'PrintForm1.PrintAction = Printing.PrintAction.PrintToPrinter
    PrintForm1.Print()  'PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)  '
    

提交回复
热议问题