Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the total number of pages of the existing pdf in ruby on rails?

How to get the total number of pages of the existing pdf in rails?

like image 632
Manish Shrivastava Avatar asked Feb 14 '12 12:02

Manish Shrivastava


1 Answers

You can use pdf-reader (also available as a ruby gem). Usage is as simple as

reader = PDF::Reader.new("somefile.pdf")
puts reader.page_count
like image 84
jupp0r Avatar answered Nov 13 '22 09:11

jupp0r