Setting the paper size

后端 未结 5 734
灰色年华
灰色年华 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:10

    You can use as follws and user can set the page size within the setting form.

            private void button1_Click(object sender, EventArgs e)
            {
                PrintDialog printdg = new PrintDialog();
                if (printdg.ShowDialog() == DialogResult.OK)
                {
                    PrintDocument pd = new PrintDocument();
                    pd.PrinterSettings = printdg.PrinterSettings;
                    pd.PrintPage += PrintPage;
                    pd.Print();
                    pd.Dispose();
                }
            }
            private void PrintPage(object o, PrintPageEventArgs e)
            {
               // Printng logic
            }
    

提交回复
热议问题