Hello,
I have a one-page pdf document template for which I require to know exactly what the dimensions of the occupied area is i.e.
PdfDocument pdfDocument = new PdfDocument("header.pdf");
MergeDocument mergeDocument = new MergeDocument(pdfDocument);
Page page = mergeDocument.getPages().getPage(0);
System.out.println(page.getDimensions().getHeight());
System.out.println(page.getDimensions().getWidth());
This will always print the numbers below disregard of what the actual occupied area in the document is:
842.0
595.22
No clue exactly what these numbers are because when producing the document with the LayoutGrid, I see the maximum dimensions to be something different.
Can anyone advice please.
Thanks in advance,
Best regards,
Giovanni
occupied area on pdf document
Re: occupied area on pdf document
Support · Mar 1, 2010Hello Giovanni,
The getHeight() and getWidth() methods of the page dimensions gives the height and width of the page. You will have to remove the page margins from this size.
You can get the margins using getBottomMargin(), getTopMargin(), getLeftMargin() and getRightMargin() methods of the page dimensions. You will have to deduct left and right margins to get the actual width of the body, and deduct bottom and top margins to get the height of the body.
If you are still having any problem then please send over the PDF document and the code you are using to our [^a|mailto:support@cete.com|Support Team^] so that they can help you further.
Thanks,
ceTe Software Support Team.
Re: occupied area on pdf document
Forum member · Mar 1, 2010Hello,
Thank you for your quick response.
I have already submitted the code and templates to the given email. The support incident number is S10465751.
Please note what I would like to get is the net dimensions of the "visual content" e.g. if there is a single sentence in the page I would like to get something on the order of (width=62,height=20)
Thanks in advance,
Best regards,
Giovanni
Re: occupied area on pdf document
Support · Mar 1, 2010Hello Giovanni,
It is not possible to get the visible content's height and width of a document using our product. You can get the height and width of form fields using our product. You may enforce the users to have a hidden form field with height and width sufficient to have the data they are going to add to the page.
Thanks,
ceTe Software Support Team.