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
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']
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.