PdfViewer.QueryPageSettings Event
In This Article
Occurs before the PdfViewer.PrintPage event.
Namespace: DevExpress.XtraPdfViewer
Assembly: DevExpress.XtraPdfViewer.v24.2.dll
NuGet Package: DevExpress.Win.PdfViewer
#Declaration
public event PdfQueryPageSettingsEventHandler QueryPageSettings
#Event Data
The QueryPageSettings event's data class is PdfQueryPageSettingsEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Cancel |
Gets or sets a value indicating whether the event should be canceled.
Inherited from Cancel |
Page |
Gets the page number in a document. |
Page |
Gets or sets the page settings for the page to be printed.
Inherited from Query |
Page |
Gets the size of the current page. |
Print |
Returns Print |
Print |
Gets or sets a value which indicates whether to print the document content in grayscale. |
#Remarks
Handle the QueryPageSettings
event to specify print settings for a specific page.
#Example
The code snippet below handles the QueryPageSettings
and PrintPage
events to specify the landscape orientation for a second page and add an image on each printed page.
pdfViewer.QueryPageSettings += PdfViewer_QueryPageSettings;
pdfViewer.PrintPage += OnPrintPage;
//...
private void PdfViewer_QueryPageSettings(object sender, PdfQueryPageSettingsEventArgs e)
{
// Print the second page in landscape size.
if (e.PageNumber == 2)
{
e.PageSettings.Landscape = true;
}
else e.PageSettings.Landscape = false;
}
private static void OnPrintPage(object sender, PdfPrintPageEventArgs e) {
// Draw a picture on each printed page.
using (Bitmap image = new Bitmap(@"..\..\DevExpress.png"))
e.Graphics.DrawImage(image, new RectangleF(10, 30, image.Width / 2, image.Height / 2));
}
See Also