Hi,
I'm working with the Shrine gem and uploading PDF files to S3 (direct upload).
During the upload, the code is adding some metadata such as the page count.
I noticed that PDF::Reader accepts IO objects as input, but it's not working with the Down::ChunkedIOclass.
This is the code from the shrine uploader:
add_metadata do |file, metadata:, record:, **|
case metadata["mime_type"]
when "application/pdf"
io = file.to_io if file.respond_to?(:to_io)
reader = PDF::Reader.new(io)
{ page_count: reader.page_count }
Exception:
ArgumentError: input must be an IO-like object or a filename (Down::ChunkedIO)
Hi, I'm working with the Shrine gem and uploading PDF files to S3 (direct upload). During the upload, the code is adding some metadata such as the page count.
I noticed that PDF::Reader accepts IO objects as input, but it's not working with the
Down::ChunkedIO
class.This is the code from the shrine uploader:
Exception:
Code from PDF::Reader that will try to read the IO object. https://github.com/yob/pdf-reader/blob/625e8dca295d8b6a48f634cba812f14fd3b805a4/lib/pdf/reader/object_hash.rb#L601
Is it possible to PDF::Reader to support
Down::ChunkedIO
?Any thoughts?
Thank you.