I have used tools like qpdf
and pdfinfo
from the poppler-utils to get information about PDF documents. However I am looking for a way to get more specific information like the width of margins, the font families used, etc. pdfinfo
does not get this info and neither does qpdf
. qpdf
does however have a --json
option which converts the PDF into its JSON representation. I am only slightly familiar with JSON but I could not find any property called "Margin" or "Font-Family". Is information like this even recorded in the PDF format?
I wasn't sure if this a question fit for this board or StackOverflow, because if there are programmatic ways to extract this information (like a C or Python library), I would be willing to use those as well. Any suggestions?
My primary aim is to be able to replicate all the margin/font information from a document (assuming they are consistent and have been made from a program like TeX or LaTeX), so I can reproduce their exact style. Right now, I have to use a facility offered by my PDF viewer using a cursor to calculate margins (or any kind of length) using coordinates and as for the fonts, I have to guess them.
gs -sDEVICE=bbox
), and use a font detection tool for much the same (for embedded fonts that don't retain any info on their origin).