-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undefined method `objects' for #<PDF::Reader::FormXObject #522
Comments
That's a surprising error! Is the |
yes, and it has |
Could you make a minimal reproduction? I'm not sure how else I can debug it from here. Also, it it only happening on a particular PDF file or all PDFs? |
I just took code from example: def process_page(page, count)
xobjects = page.xobjects
return count if xobjects.empty?
xobjects.each do |name, stream|
case stream.hash[:Subtype]
when :Image then
count += 1
case stream.hash[:Filter]
when :CCITTFaxDecode then
ExtractImages::Tiff.new(stream).save("#{page.number}-#{count}-#{name}.tif")
when :DCTDecode then
ExtractImages::Jpg.new(stream).save("#{page.number}-#{count}-#{name}.jpg")
else
ExtractImages::Raw.new(stream).save("#{page.number}-#{count}-#{name}.tif")
end
when :Form then
count = process_page(PDF::Reader::FormXObject.new(page, stream), count)
end
end
count
end with something like: reader = PDF::Reader.new(@pdf_file_name)
reader.pages.each_with_index do |page, idx|
process_page(page, 0)
# some code
end And got this error. I tried with 1 pdf only, because i had task to extract images from there. But i think problem is not in pdf, problem is in example code, if page is |
I'm trying to extract images from pdf file, and use code from
examples
section, and i'm getting this error:in this line:
What should i do?
The text was updated successfully, but these errors were encountered: