Anyone know of a way to get number of pages in a P...
# suitescript
x
Anyone know of a way to get number of pages in a PDF?
n
#pagenumber I suppose. It's been a while.
d
they're BFO variables: pagenumber and totalpages which are used like HTML elements:
<pagenumber/>
and
<totalpages/>
I think there are more
BFO is the XHTML to PDF engine. The PDF template and the data source (i.e. a transaction) gets merged together by Freemarker. This 'processed template' is then used by BFO to make the PDF. Only BFO knows how many PDF pages there are going to end up being, so you cannot use
pagenumber
as a variable in your Freemarker template
Have just realised you may be asking about counting the number of pages in a PDF in the filecabinet using SuiteScript facepalm Let me know if that's actually what you're asking about
x
@David B, that is what I'm asking about. Ideally was looking to find a way to get the number of pages based on the PDF data in a pre-existing file.
Thanks for the bit about BFO though, too! That actually solves part of the project that makes up my current existental crisis, hahaha.
d
This Stack Overflow question has a JS library solution and a pure JS solution: https://stackoverflow.com/questions/10253669/how-to-get-the-number-of-pages-of-a-pdf-uploaded-by-user
just have to figure out how to go from a PDF in the file cabinet to a File
x
I've actually been to this page already. The FileReader object doesn't work in Netsuite, at least from my experience.