Page 1 of 1

Stats.NumberOfPages

Posted: Mon May 17, 2021 3:38 pm
by foxpalace
Hi,
how do I get the Switch-Stats-Values in NodeJS?
Greeting
Michael

Re: Stats.NumberOfPages

Posted: Mon May 17, 2021 4:57 pm
by laurentd
Hi Michael,

Switch 2021 Spring will bring PdfDocument and PdfPage Classes.
getNumberOfPages( ) is what you need.
It will be released on May 27th.

Re: Stats.NumberOfPages

Posted: Thu May 27, 2021 2:43 pm
by foxpalace
Hi Laurentd,

today ist May 27th, System requirements is uptodate, but I can't download 2021 spring. I would like to update my Switch-Dev-Version :)

Re: Stats.NumberOfPages

Posted: Thu May 27, 2021 5:06 pm
by laurentd
Hi Michael,

The mail about Switch 2021 Spring has been sent an hour ago.
https://www.enfocus.com/en/support/rele ... ease-notes

Re: Stats.NumberOfPages

Posted: Fri Jan 14, 2022 4:07 am
by Sunnyland
Looking to get the Width and Height of the PDF Document. I have upgraded to Switch Fall 2021 my node script has be written previous to PdfDocument being added to Spring 2021.

What do I need to do to update my script as it is not reconising PdfDocument as a class?

My nodejs version is 14.15.0

Re: Stats.NumberOfPages

Posted: Fri Jan 14, 2022 9:44 am
by laurentd
Here is an example how to use PdfDocument and PdfPage classes on our EnfocusSW GitHub:

https://github.com/EnfocusSW/PdfProperties

Re: Stats.NumberOfPages

Posted: Sun Jan 16, 2022 10:10 pm
by Sunnyland
Thanks Laurentd,
But from what can figure out my script is using verion 1.0.1 of types-switch-scripting, To update to fall 2021 I think I should be using version 21.1.0. What is the best way to update this without writing the script again?

Re: Stats.NumberOfPages

Posted: Mon Jan 17, 2022 10:07 am
by laurentd
The PdfDocument and PdfPage classes were introduced with Switch 2021 Spring.
This will update the type definition:
npm i @types/switch-scripting@1.1.0

Re: Stats.NumberOfPages

Posted: Mon Jan 17, 2022 10:54 pm
by Sunnyland
Thanks Laurentd,
Really appreciate the replies.
I received an error '@types/switch-scripting@1.1.0' is not in the npm registry.

I just had to change npm i @types/switch-scripting@1.1.0
to
npm i @types/switch-scripting and it updated fine.