Patagames Software Support Forum
»
Pdfium.Net SDK
»
FAQ
»
How to get the bleedbox and trimbox of the Page?
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 935
Thanks: 3 times Was thanked: 112 time(s) in 109 post(s)
|
Question:Is there a way in winform PDF viewer to get the x,y,width and height of the bleedbox and trimbox from a pdf page? Thanks. Answer:You can get access to these boundaries through page dictionary. Here's an example: Code:
var doc = PdfDocument.Load(@"d:\0\9\mp4.pdf");
var pageDict = doc.Pages[0].Dictionary;
FS_RECTF cropBox = ConvertToPdfRect(pageDict["CropBox"] as PdfTypeArray);
FS_RECTF bleedBox = ConvertToPdfRect(pageDict["BleedBox"] as PdfTypeArray);
FS_RECTF trimBox = ConvertToPdfRect(pageDict["TrimBox"] as PdfTypeArray);
private static FS_RECTF ConvertToPdfRect(PdfTypeArray cropBoxArray)
{
return new FS_RECTF()
{
left = (cropBoxArray[0] as PdfTypeNumber).FloatValue,
bottom = (cropBoxArray[1] as PdfTypeNumber).FloatValue,
right = (cropBoxArray[2] as PdfTypeNumber).FloatValue,
top = (cropBoxArray[3] as PdfTypeNumber).FloatValue
};
}
Please note the these boundaries are given in PDF user scope coordinate system. To convert them to PdfViewer coordinate system you should call PageToCient method https://pdfium.patagames.com/help/html/563e2f2f-957a-dbf2-55a5-ca8368e609c4.htmEdited by user Thursday, June 8, 2017 11:24:04 PM(UTC)
| Reason: Not specified
|
|
|
|
Patagames Software Support Forum
»
Pdfium.Net SDK
»
FAQ
»
How to get the bleedbox and trimbox of the Page?
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close