PdfViewerPrintDocumentWithSettings Method (PageSettings, PrinterSettings)
Prints the Pdf document with settings. If the document size is not complatible to page size, pdf.kit will extend it to fit page size.

Namespace: Aspose.Pdf.Facades
Assembly: Aspose.PDF (in Aspose.PDF.dll) Version: 21.9.0
Syntax
public void PrintDocumentWithSettings(
	PageSettings pageSettings,
	PrinterSettings printerSettings
)

Parameters

pageSettings
Type: System.Drawing.PrintingPageSettings
The page setting of the printing document.
printerSettings
Type: System.Drawing.PrintingPrinterSettings
The printer setting of the printing document.
Examples
 [C#]
PdfViewer viewer = new PdfViewer();
viewer.OpenPdfFile(@"d:\test.pdf");
viewer.AutoResize = true;         //print the file with adjusted size
viewer.AutoRotate = true;         //print the file with adjusted rotation
viewer.PrintPageDialog=false;//do not produce the page number dialog when printing
System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
PrintDocument prtdoc = new PrintDocument();
ps.PrinterName = prtdoc.PrinterSettings.PrinterName;
PageSettings pgs = new PageSettings();
pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);
pgs.Margins = new Margins(0, 0, 0, 0);
viewer.PrintDocumentWithSettings(pgs, ps);
viewer.ClosePdfFile();

[VisualBasic]
Dim viewer As PdfViewer = new PdfViewer()
viewer.OpenPdfFile(@"d:\test.pdf")
viewer.AutoResize = true;           'print the file with adjusted size
viewer.AutoRotate = true;           'print the file with adjusted rotation
viewer.PrintPageDialog=false;//do not produce the page number dialog when printing
Dim ps As System.Drawing.Printing.PrinterSettings = new System.Drawing.Printing.PrinterSettings()
Dim prtdoc As PrintDocument = new PrintDocument()
ps.PrinterName = prtdoc.PrinterSettings.PrinterName
Dim pgs As PageSettings=new PageSettings()
pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169)
pgs.Margins = new Margins(0, 0, 0, 0)
viewer.PrintDocumentWithSettings(pgs, ps)
viewer.ClosePdfFile()
Remarks
printerSettings object is used to print the document. pageSettings.PrinterSettings object is ignored.
See Also