gettalong / hexapdf

Versatile PDF creation and manipulation for Ruby
https://hexapdf.gettalong.org
Other
1.21k stars 69 forks source link

Argument Error doc.add #218

Closed rebelcolony closed 1 year ago

rebelcolony commented 1 year ago

doc = HexaPDF::Document.open(path_to_file) form = doc.add(Type: :XObject, Subtype: :Form, BBox: HexaPDF::Type::Page.media_box(:A4))

ArgumentError (wrong number of arguments (given 0, expected 1) rails 6.1.7 ruby 3.1.3 Mac M1

gettalong commented 1 year ago

You need to enclose the hash in curly brackets (see https://hexapdf.gettalong.org/documentation/reference/api/HexaPDF/Document/index.html#method-i-add) since the value is a positional argument:

doc = HexaPDF::Document.open(path_to_file)
form = doc.add({Type: :XObject, Subtype: :Form, BBox: HexaPDF::Type::Page.media_box(:A4)})