officefileapi-devexpress-dot-pdf-dot-pdfdocumentprocessor-dot-print-x28-devexpress-dot-pdf-dot-pdfprintersettings-x29.md
Prints the document with custom printer settings.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Docs.v25.2.dll
NuGet Package : DevExpress.Document.Processor
public void Print(
PdfPrinterSettings printerSettings
)
Public Sub Print(
printerSettings As PdfPrinterSettings
)
| Name | Type | Description |
|---|---|---|
| printerSettings | PdfPrinterSettings |
An object providing printer settings.
|
Use the PdfPrinterSettings object to specify custom printer settings (orientation, scale, dpi, etc.). Use the PdfPrinterSettings.Settings property to access .NET print options.
Note
The PdfPrinterSettings.Settings options are available only on Windows OS. Use the PdfPrinterSettings.DXSettings property to obtain cross-platform printer settings.
The code example below prints a document with custom printer settings.
View Example: PDF Document API - Specify the PDF Printer Settings
using DevExpress.Pdf;
// Create a Pdf Document Processor instance
// and load a PDF file
PdfDocumentProcessor documentProcessor = new PdfDocumentProcessor();
documentProcessor.LoadDocument(@"..\..\Demo.pdf");
// Declare printer settings.
PdfPrinterSettings pdfPrinterSettings = new PdfPrinterSettings();
// Specify printer settings.
pdfPrinterSettings.PageOrientation = PdfPrintPageOrientation.Portrait;
pdfPrinterSettings.PageNumbers = new int[] { 1, 3, 4, 5 };
// Specify the custom scale number
pdfPrinterSettings.ScaleMode = PdfPrintScaleMode.CustomScale;
pdfPrinterSettings.Scale = 90;
// Specify .NET printer settings
PrinterSettings settings = pdfPrinterSettings.Settings;
settings.Duplex = Duplex.Vertical;
settings.Copies = 3;
// Print the document
documentProcessor.Print(pdfPrinterSettings);
Imports DevExpress.Pdf
' Create a Pdf Document Processor instance
' and load a PDF into it.
Dim documentProcessor As New PdfDocumentProcessor()
documentProcessor.LoadDocument("..\..\Demo.pdf")
' Declare the PDF printer settings.
Dim pdfPrinterSettings As New PdfPrinterSettings()
' Specify the PDF printer settings.
pdfPrinterSettings.PageOrientation = PdfPrintPageOrientation.Portrait
pdfPrinterSettings.PageNumbers = New Integer() { 1, 3, 4, 5 }
' Specify the custom scale number
pdfPrinterSettings.ScaleMode = PdfPrintScaleMode.CustomScale
pdfPrinterSettings.Scale = 90
' Specify .NET printer settings
Dim settings As PrinterSettings = pdfPrinterSettings.Settings
settings.Duplex = Duplex.Vertical
settings.Copies = 3
' Print the document using the specified printer settings.
documentProcessor.Print(pdfPrinterSettings)
The following code snippets (auto-collected from DevExpress Examples) contain references to the Print(PdfPrinterSettings) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
pdf-document-api-customize-pdf-print-output/CS/CustomizePrintSettings/Program.cs#L25
// Print the document using the specified printer settings.
documentProcessor.Print(settings);
pdf-document-api-specify-printer-settings/CS/PdfProcessorPrinterOptions/Program.cs#L26
// Print the document using the specified printer settings.
documentProcessor.Print(pdfPrinterSettings);
}
pdf-document-api-customize-pdf-print-output/VB/CustomizePrintSettings/Program.vb#L21
' Print the document using the specified printer settings.
documentProcessor.Print(settings)
' Unsubscribe from PrintPage and QueryPageSettings events.
pdf-document-api-specify-printer-settings/VB/PdfProcessorPrinterOptions/Program.vb#L21
' Print the document using the specified printer settings.
documentProcessor.Print(pdfPrinterSettings)
End Sub
See Also