Spread Windows Forms 8.0 Product Documentation > Developer's Guide > Managing Printing > Customizing the Appearance of the Printing > Customizing the Print Job Settings |
Sheets are printed on the current default printer in your Windows environment unless you specify otherwise. You can print sheets on any Windows-supported printer.
The print job settings that you can customize include: printer, source, and page size. Set the Printer, PaperSource, or PaperSize on the PrintInfo object.
This example code sets the paper source based on a selection from a combo box and sets the paper size before printing all the sheets.
C# |
Copy Code
|
---|---|
private void Form1_Load(object sender, System.EventArgs e) { int i; System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings(); for (i = 0; i <= ps.PaperSources.Count - 1; i++) { comboBox1.Items.Add(ps.PaperSources[i].SourceName); } comboBox1.Text = ps.PaperSources[0].SourceName; } private void button1_Click(object sender, System.EventArgs e { FarPoint.Win.Spread.PrintInfo pi = new FarPoint.Win.Spread.PrintInfo(); System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings(); pi.PaperSize = new System.Drawing.Printing.PaperSize("Letter", 600, 300); pi.PaperSource = ps.PaperSources[comboBox1.SelectedIndex]; fpSpread1.Sheets[0].PrintInfo = pi; fpSpread1.PrintSheet(-1); } |
VB |
Copy Code
|
---|---|
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim ps As New System.Drawing.Printing.PrinterSettings() Dim i As Integer For i = 0 To ps.PaperSources.Count - 1 ComboBox1.Items.Add(ps.PaperSources.Item(i).SourceName) Next ComboBox1.Text = ps.PaperSources.Item(0).SourceName End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim pi As New FarPoint.Win.Spread.PrintInfo() Dim ps As New System.Drawing.Printing.PrinterSettings() pi.PaperSize = New System.Drawing.Printing.PaperSize("Letter", 600, 300) pi.PaperSource = ps.PaperSources(ComboBox1.SelectedIndex) FpSpread1.Sheets(0).PrintInfo = pi FpSpread1.PrintSheet(-1) End Sub |