Get Page Count of PDF in Ruby
Contents
[
Hide
]
Aspose.PDF - Get Page Count
To get page count of Pdf document using Aspose.PDF Java for Ruby, simply invoke GetNumberOfPages module.
Ruby Code
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
# Create PDF document
pdf = Rjb::import('com.aspose.pdf.Document').new(data_dir + 'input1.pdf')
page_count = pdf.getPages().size()
puts "Page Count:" + page_count.to_s
Download Running Code
Download Get Page Count (Aspose.PDF) from any of the below mentioned social coding sites: