Search code examples
jsonpdfpdf.js

pdf2json Page Unit: What is it?


I'm trying to use modesty/pdf2json and the output is very useful, but i'm try to figuring the measure units that the library uses. They call it "Page Units", and according to the pdf specs, this is'nt equal to the 1/72 (point), because an entire page has 51 Page Units on height

Anybody knows what is this Page Unit? Where i can find info about this measurement?

Many thanks in advance.


Solution

  • Whatever pdf2json produces is not related to the PDF.js (PDF.js uses standard PDF space unit as a base)

    So based on https://github.com/modesty/pdf2json/blob/3fe724db05659ad12c2c0f1b019530c906ad23de/lib/pdfunit.js :

    • pdf2json gets data from PDF.js in 96dpi units
    • scales every unit by 1/4

    So page unit equal (96px/inch * 1inch / 4) = 24px.

    In your example height is equal 51 * 24px = 1,224px, or 51 * 0.25inch = 12.72inch