I need to get the count of pages in PDF files stored in Ruby on Rails 5.2.3 ActiveStorage using Docsplit.
I'm uploading PDF documents using Ruby on Rails ActiveStorage. I understand these documents are stored as a blob. I was hoping I could pass the reference to the PDF file to Docsplit with something like:
pages = Docsplit.extract_length(@car_record.crecord)
But the above resulted in an error:
no implicit conversion of ActiveStorage::Attached::One into String
Docsplit.extract_length
expects a string (presumably a path to a local file), and@car_record.crecord
returns an ActiveRecord object.You should be able to do something like,
Edit:
ActiveStorage::Downloading
is being removed in 6.1. Try something like the following: