yihui / animation

A gallery of animations in statistics and utilities to create animations
https://yihui.org/animation/
206 stars 60 forks source link

Number of pages in pdf #136

Open ggrothendieck opened 2 years ago

ggrothendieck commented 2 years ago

It would be nice if there were a function to return the number of pages in a pdf since that can be needed for some calculations. This is already possible using pdftk but is a bit verbose. See https://stackoverflow.com/questions/72289280/split-pdf-files-in-multiples-files-every-2-pages-in-r/72290330#72290330

yihui commented 2 years ago

You can use qpdf::pdf_length(). Thanks for the suggestion, though!

ggrothendieck commented 2 years ago

The link in my message does point that out but the point is that pdftk itself can do it but it is onerous to access it.

yihui commented 2 years ago

Okay, then if anyone wants to contribute a PR, I'll be happy to merge it (although it seems to be beyond the scope of this animation package). Thanks!