galkahana / HummusJS

Node.js module for high performance creation, modification and parsing of PDF files and streams
http://www.pdfhummus.com
Other
1.14k stars 169 forks source link

Getting page dimensions #212

Closed Protoneer closed 6 years ago

Protoneer commented 6 years ago

Is there a way to determine the page dimensions? (used with pageModifier.startContext().getContext().writeText("text",X,Y,TextOptions) )

I need to add at each corner of the page, but I can't find a way to get the max page dimensions.

Unfortunately all of the PDF's I am adding the timestamp to are different sizes page sizes.

Thanks for the good work, by the way.

chunyenHuang commented 6 years ago

You can get the metadata/dimensions from the page info. https://github.com/galkahana/HummusJS/wiki/Parsing

Protoneer commented 6 years ago

For some reason the pageInfo was empty.

I made compromise populating the 0,0 corner with the needed text.

galkahana commented 6 years ago

hmfff. good solution, thought its unfortunate that you didn't get the size. normally they should be available via pageInfo.getMediaBox()