Reputation: 21
I am studying the structure of a PDF file. How can I determine the info like paper size, margin and font sizes from a PDF file? I know F13 is for Helvetica, but how about the other fonts? I cannot find them even from Adobe doc about PDF.
Upvotes: 0
Views: 2396
Reputation: 95918
I am studying the structure of a PDF file.
Please do so using the PDF specification ISO 32000-1.
How can I determine the info like paper size,
Each page has its own size, it is defined in the Page dictionary or inherited:
MediaBox rectangle (Required; inheritable) A rectangle (see 7.9.5, "Rectangles"), expressed in default user space units, that shall define the boundaries of the physical medium on which the page shall be displayed or printed (see 14.11.2, "Page Boundaries").
CropBox rectangle (Optional; inheritable) A rectangle, expressed in default user space units, that shall define the visible region of default user space. When the page is displayed or printed, its contents shall be clipped (cropped) to this rectangle and then shall be imposed on the output medium in some implementation-defined manner (see 14.11.2, "Page Boundaries"). Default value: the value of MediaBox.
(Table 30 – Entries in a page object)
margin
There is no margin unless you mean a margin implied by some of the boxes above.
and font sizes from a PDF file?
The size at which a font is used to draw some text is defined in the content stream by the Tf instruction and transformed by the current transformation matrix and text matrix.
font size Tf Set the text font, Tf, to font and the text font size, Tfs, to size. font shall be the name of a font resource in the Font subdictionary of the current resource dictionary; size shall be a number representing a scale factor. There is no initial value for either font or size; they shall be specified explicitly by using Tf before any text is shown.
(Table 105 – Text state operators)
Furthermore,
I know F13 is for Helvetica,
There might be one PDF page for which that is the case but for the next one it might be F2, Helv, ASDFjklgfklöjsflaksfd, or whatever you want
Upvotes: 5