gettalong / hexapdf

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

Filling form results in undefined method `*' for nil:NilClass #244

Closed thomasbaustert closed 1 year ago

thomasbaustert commented 1 year ago

Hi and thanks for hexapdf! I tried to fill out the following PDF template which results in undefined method*' for nil:NilClass. Thecap_heightisnil`. Other PDF templates work fine so far but this one failed. All templates are created with Adobe.

require 'hexapdf'

values = {
  'Tagesdatum' => Date.today.strftime('%d.%m.%Y')
}.freeze

doc = HexaPDF::Document.open('vorlage-test.pdf')
doc.acro_form.each_field do |field|
  value = values.fetch(field.field_name)

  field.field_value = value.to_s
  field.flag(:read_only)
end

vorlage-test.pdf

gettalong commented 1 year ago

Thanks for reporting - I have found the problem and a solution. Will incorporate the fix into a release due tomorrow.

thomasbaustert commented 1 year ago

Thanks for the quick feedback!

gettalong commented 1 year ago

I just released 0.32.1 with the fix.