Reputation: 31
I am having trouble counting the number of pages doc and docx when inputting a file. Do you have any workarounds that can help me? Thank you
Upvotes: 1
Views: 224
Reputation: 658
You can use yomu gem and get number of pages from metadata
doc_data = File.read 'sample_file.docx' metadata = Yomu.read :metadata, doc_data page_numbers = metadata['Page-Count']
Upvotes: 2