officefileapi-devexpress-dot-pdf-dot-pdfpagetreeobject.md
Specifies the crop box imposing the page boundaries displayed in a PDF Viewer.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public PdfRectangle CropBox { get; set; }
Public Property CropBox As PdfRectangle
| Type | Description |
|---|---|
| PdfRectangle |
A PdfRectangle object, specifying the crop box.
|
The crop box defines the region to which the contents of the page shall be clipped (cropped) when displayed or printed.
The default setting is the page’s PdfPageTreeObject.MediaBox value.
Note
The PDF page unit of measurement is points, which measures 1/72 of an inch (0.3528 mm). You can convert this unit of measurement, e.g., to pixels using the Units.PointsToPixelsF method.
The following code snippets (auto-collected from DevExpress Examples) contain references to the CropBox property.
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.
office-file-api-ai-implementation/CS/Controllers/SummarizeController.cs#L75
case PdfPart.FirstPage:
var firstPageBox = pdfDocumentProcessor.Document.Pages[0].CropBox;
PdfDocumentPosition pagePosition1 = new PdfDocumentPosition(1, firstPageBox.TopLeft);
how-to-custom-draw-in-pdf-viewer/CS/PDF_Viewer/Form1.cs#L47
PdfPage page = processor.Document.Pages[rect.PageIndex];
PdfRectangle pageCropBox = page.CropBox;
PdfPoint p1 = new PdfPoint(rect.Point1.X, pageCropBox.Height - rect.Point1.Y);
pdf-document-api-add-graphics-to-landscape-and-portrait-pages/CS/CreateGraphics/Program.cs#L47
{
PdfRectangle cropBox = page.CropBox;
float cropBoxWidth = ConvertFromPdfUnits((float)cropBox.Width, dpiX);
how-to-custom-draw-in-pdf-viewer/VB/PDF_Viewer/Form1.vb#L43
Dim page As PdfPage = processor.Document.Pages(rect.PageIndex)
Dim pageCropBox As PdfRectangle = page.CropBox
Dim p1 As PdfPoint = New PdfPoint(rect.Point1.X, pageCropBox.Height - rect.Point1.Y)
pdf-document-api-add-graphics-to-landscape-and-portrait-pages/VB/CreateGraphics/Program.vb#L41
Private Shared Function PrepareGraphics(ByVal page As PdfPage, ByVal graphics As PdfGraphics, ByVal dpiX As Single, ByVal dpiY As Single) As SizeF
Dim cropBox As PdfRectangle = page.CropBox
Dim cropBoxWidth As Single = ConvertFromPdfUnits(CSng(cropBox.Width), dpiX)
See Also