Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix ObjectStore importing stream objects with indirect references in …

…their dict

- Streams were being imported as strings, no streams and the hash was
  being dropped completely
- The easiest way to detect this is to count the number of imported
  objects. Since the stream dictionaries were being dropped, and
  indirect reference contained in them weren't being imported, leaving
  our import short a few objects
  • Loading branch information...
commit c0c5bb838688b9471c5aad3582c9e47921d53b66 1 parent 8a589b5
@yob yob authored
View
BIN  data/pdfs/indirect_reference.pdf
Binary file not shown
View
4 lib/prawn/core/object_store.rb
@@ -159,6 +159,10 @@ def load_object_graph(hash, object)
end
end
@loaded_objects[object.id]
+ when PDF::Reader::Stream
+ # Stream is a subclass of string, so this is here to prevent the stream
+ # being wrapped in a LiteralString
+ object
when String
Prawn::Core::LiteralString.new(object)
else
View
6 spec/object_store_spec.rb
@@ -34,6 +34,12 @@
store.pages.data[:Count].should == 1
end
+ it "should import all objects from a PDF that has an indirect reference in a stream dict" do
+ filename = "#{Prawn::BASEDIR}/data/pdfs/indirect_reference.pdf"
+ store = Prawn::Core::ObjectStore.new(:template => filename)
+ store.size.should == 8
+ end
+
it "should add to its objects when ref() is called" do
count = @store.size
@store.ref("blah")
Please sign in to comment.
Something went wrong with that request. Please try again.