Difference between various Box in page class

Hi,


What is the difference between Artbox,BleedBox,CropBox, MediaBox,TrimBox and Rect property of the Page class. Can you please share some examples of usage.

Regards,
Sandeep

Hi Sandeep,


Thanks for your inquiry. Please note xxxBox properties represents coordinates of respective box of Page and Rect property represents actual page coordinates stored in Page dictionary.

Moreover, Rect property does not consider page rotation parameter by default. In order to take into consideration page rotation, we have Page.GetPageRect(bool considerRotation) method. If we pass considerRotation parameter as true then it consider rotation angle and return actual rectangle dimensions. Please check following code snippet:

foreach (Page page in doc.Pages)
{
Rectangle rect = page.GetPageRect(true);
Console.WriteLine(“Page {0} width is {1} and heigth is {2}, rotation: {3}, size considering rotation: widht {4} : height {5}”, page.Number, page.Rect.Width, page.Rect.Height, page.Rotate.ToString(), rect.Width, rect.Height);
}


Please feel free to contact us for any further assistance.


Best Regards,