Stats.NumberOfPages

Post Reply
User avatar
foxpalace
Member
Posts: 26
Joined: Fri Jan 14, 2011 12:25 pm
Location: Germany

Stats.NumberOfPages

Post by foxpalace » Mon May 17, 2021 3:38 pm

Hi,
how do I get the Switch-Stats-Values in NodeJS?
Greeting
Michael

laurentd
Member
Posts: 85
Joined: Wed Mar 13, 2019 2:06 pm

Re: Stats.NumberOfPages

Post by laurentd » Mon May 17, 2021 4:57 pm

Hi Michael,

Switch 2021 Spring will bring PdfDocument and PdfPage Classes.
getNumberOfPages( ) is what you need.
It will be released on May 27th.
Laurent De Wilde, Solution Architect @ Enfocus

User avatar
foxpalace
Member
Posts: 26
Joined: Fri Jan 14, 2011 12:25 pm
Location: Germany

Re: Stats.NumberOfPages

Post by foxpalace » Thu May 27, 2021 2:43 pm

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 :)

laurentd
Member
Posts: 85
Joined: Wed Mar 13, 2019 2:06 pm

Re: Stats.NumberOfPages

Post by laurentd » Thu May 27, 2021 5:06 pm

Hi Michael,

The mail about Switch 2021 Spring has been sent an hour ago.
https://www.enfocus.com/en/support/rele ... ease-notes
Laurent De Wilde, Solution Architect @ Enfocus

Sunnyland
Member
Posts: 54
Joined: Mon Aug 19, 2013 1:34 am

Re: Stats.NumberOfPages

Post by Sunnyland » Fri Jan 14, 2022 4:07 am

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

laurentd
Member
Posts: 85
Joined: Wed Mar 13, 2019 2:06 pm

Re: Stats.NumberOfPages

Post by laurentd » Fri Jan 14, 2022 9:44 am

Here is an example how to use PdfDocument and PdfPage classes on our EnfocusSW GitHub:

https://github.com/EnfocusSW/PdfProperties
Laurent De Wilde, Solution Architect @ Enfocus

Sunnyland
Member
Posts: 54
Joined: Mon Aug 19, 2013 1:34 am

Re: Stats.NumberOfPages

Post by Sunnyland » Sun Jan 16, 2022 10:10 pm

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?

laurentd
Member
Posts: 85
Joined: Wed Mar 13, 2019 2:06 pm

Re: Stats.NumberOfPages

Post by laurentd » Mon Jan 17, 2022 10:07 am

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
Laurent De Wilde, Solution Architect @ Enfocus

Sunnyland
Member
Posts: 54
Joined: Mon Aug 19, 2013 1:34 am

Re: Stats.NumberOfPages

Post by Sunnyland » Mon Jan 17, 2022 10:54 pm

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.

Post Reply