ruby on rails - Inconsistent display of checkboxes on PDF form filled with PDFtk -
i filling pdf forms in rails app pdf-forms (https://github.com/jkraemer/pdf-forms) gem, based on pdftk. text fields work expect, checkbox fields not. boxes display in chrome, in preview , mail checkbox fields appear empty.
class formscontroller < applicationcontroller require 'pdf_forms' def acord25 @policy = policy.find(params[:id]) pdftk = pdfforms.new('/usr/local/bin/pdftk') # find out field names present in form.pdf pdftk.get_field_names 'lib/pdfs/acord25.pdf' # take form.pdf, set 'foo' field 'bar' , save document myform.pdf pdftk.fill_form '/lib/pdfs/acord25.pdf', "acord25.pdf", "f[0].p1[0].form_completiondate_a[0]" => @policy.dateissued, "f[0].p1[0].producer_fullname_a[0]" => @policy.client.broker.name, "f[0].p1[0].producer_mailingaddress_lineone_a[0]" => @policy.client.broker.company, "f[0].p1[0].producer_mailingaddress_linetwo_a[0]" => @policy.client.broker.address, "f[0].p1[0].producer_contactperson_fullname_a[0]" => @policy.legalvesting, "f[0].p1[0].producer_contactperson_phonenumber_a[0]" => @policy.client.broker.phone, "f[0].p1[0].producer_faxnumber_a[0]" => @policy.client.broker.fax, "f[0].p1[0].producer_contactperson_emailaddress_a[0]" => @policy.client.broker.email, "f[0].p1[0].namedinsured_fullname_a[0]" => @policy.client.name, "f[0].p1[0].namedinsured_mailingaddress_lineone_a[0]" => @policy.client.address.titlecase, "f[0].p1[0].generalliability_coverageindicator_a[0]" => 1, "f[0].p1[0].generalliability_occurrenceindicator_a[0]" => 1, "f[0].p1[0].generalliability_generalaggregate_limitappliesperlocationindicator_a[0]" => 1, "f[0].p1[0].policy_policynumberidentifier_a[0]" => @policy.policynumber, "f[0].p1[0].policy_effectivedate_a[0]" => @policy.dateeffective, "f[0].p1[0].policyexpirationgeneral[0]" => @policy.term.dayend, "f[0].p1[0].insurer_fullname_a[0]" => "lexington insurance company", "f[0].p1[0].insurer_naiccode_a[0]" => 19437, "f[0].p1[0].insurer_fullname_b[0]" => "commerce & industry insurance company", "f[0].p1[0].insurer_naiccode_b[0]" => 19410, "f[0].p1[0].insurer_fullname_c[0]" => "great american insurance company", "f[0].p1[0].insurer_naiccode_c[0]" => 37532, "f[0].p1[0].insurer_fullname_d[0]" => "admiral insurance company", "f[0].p1[0].insurer_naiccode_d[0]" => 24856, "f[0].p1[0].generalliability_insurerlettercode_a[0]" => "a", "f[0].p1[0].generalliability_eachoccurrence_limitamount_a[0]" => 1000000, "f[0].p1[0].generalliability_firedamagerentedpremises_eachoccurrencelimitamount_a[0]" => 50000, "f[0].p1[0].generalliability_medicalexpense_eachpersonlimitamount_a[0]" => "excluded", "f[0].p1[0].generalliability_personalandadvertisinginjury_limitamount_a[0]" => 1000000, "f[0].p1[0].generalliability_generalaggregate_limitamount_a[0]" => 2000000, "f[0].p1[0].generalliability_productsandcompletedoperations_aggregatelimitamount_a[0]" => 2000000, "f[0].p1[0].vehicle_insurerlettercode_a[0]" => "a", "f[0].p1[0].vehicle_hiredautosindicator_a[0]" => 1, "f[0].p1[0].vehicle_nonownedautosindicator_a[0]" => 1, "f[0].p1[0].policy_policynumberidentifier_b[0]" => @policy.policynumber, "f[0].p1[0].policy_effectivedate_b[0]" => @policy.dateeffective, "f[0].p1[0].policy_expirationdate_b[0]" => @policy.term.dayend, "f[0].p1[0].vehicle_combinedsinglelimit_eachaccidentamount_a[0]" => 1000000, "f[0].p1[0].excessumbrella_insurerlettercode_a[0]" => "b", "f[0].p1[0].excessumbrella_occurrenceindicator_a[0]" => 1, "f[0].p1[0].excessumbrella_deductibleindicator_a[0]" => 1, "f[0].p1[0].excessumbrella_umbrella_deductibleorretentionamount_a[0]" => @policy.coverages.first.deductibleocc, "f[0].p1[0].policy_policynumberidentifier_d[0]" => @policy.policynumber, "f[0].p1[0].policy_effectivedate_d[0]" => @policy.dateeffective, "f[0].p1[0].policy_expirationdate_d[0]" => @policy.term.dayend, "f[0].p1[0].excessumbrella_umbrella_eachoccurrenceamount_a[0]" => 10000000, "f[0].p1[0].excessumbrella_umbrella_aggregateamount_a[0]" => 10000000 send_file("#{rails.root}/acord25.pdf", filename: "#{@policy.client.name} - #{@policy.carrier.name} - #{@policy.policynumber} (#{time.now}).pdf", type: "application/vnd.ms-excel") end end
tl;dr: checked boxes display in chrome, not in preview or mail.
i appreciate or leads on problem might be. thank you!
turns out pdf form corrupted. had recreate form, not pdftk issue.
Comments
Post a Comment