I trying to get the sizes of header, footer and side white-spaces of PDF files using Java. E.g. File1 has a footer size of 20px, File2 has Footer size of 15px. Is there any way to determine this? Till now I have worked with iText PDFReader. It returns me the sizes of MediaBox and CropBox. I am not able to translate these values into comparable data. Any guidance would be helpful.
Asked
Active
Viewed 296 times
0
-
do you mean the page margins? – jhamon Nov 19 '19 at 10:14
-
In general the information you ask for are not explicitly present in a PDF. – mkl Nov 19 '19 at 11:59
-
@jhamon, yes, I mean the same. – noobie_coder Nov 20 '19 at 06:39
-
@mkl is there a way to get the these information, in a different way? – noobie_coder Nov 20 '19 at 06:41
-
If those margin areas are completely empty, you can determine the bounding box of the actual page contents as described in [this answer](https://stackoverflow.com/a/32417899/1729265). But beware, some PDF generators start a page by filling its whole area with a white rectangle. The solution in the referenced answer will consider such a background rectangle content, too! And actual header, footer, or margin texts will of course also count. – mkl Nov 20 '19 at 18:10