Ruby on rails 使用PDFtk填充的PDF表单上的复选框显示不一致

Ruby on rails 使用PDFtk填充的PDF表单上的复选框显示不一致,ruby-on-rails,pdf,checkbox,pdftk,Ruby On Rails,Pdf,Checkbox,Pdftk,我正在用基于PDFtk的PDF forms()gem在rails应用程序中填充PDF表单。文本字段的工作方式与我预期的相同,但复选框字段的工作方式不同。这些框在Chrome中显示良好,但在Preview和Mail中,复选框字段显示为空 class FormsController < ApplicationController require 'pdf_forms' def acord25 @policy = Policy.find(params[:id]) pdftk = PdfF

我正在用基于PDFtk的PDF forms()gem在rails应用程序中填充PDF表单。文本字段的工作方式与我预期的相同,但复选框字段的工作方式不同。这些框在Chrome中显示良好,但在Preview和Mail中,复选框字段显示为空

class FormsController < ApplicationController
require 'pdf_forms'
def acord25
  @policy = Policy.find(params[:id])
  pdftk = PdfForms.new('/usr/local/bin/pdftk')
  # find out the field names that are present in form.pdf
  pdftk.get_field_names 'lib/pdfs/acord25.pdf'

  # take form.pdf, set the 'foo' field to 'bar' and save the document to 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
类FormsController@policy.dateIssued,
“F[0].P1[0].Producer\u FullName\u A[0]”=>@policy.client.broker.name,
“F[0].P1[0].Producer\u MailingAddress\u LineOne\u A[0]”=>@policy.client.broker.company,
“F[0].P1[0].Producer\u MailingAddress\u LineTwo\u A[0]”=>@policy.client.broker.address,
“F[0].P1[0].制作人\u联系人\u全名\u A[0]”=>@policy.legalVesting,
“F[0].P1[0].制作人\u联系人\u电话号码\u A[0]”=>@policy.client.broker.phone,
“F[0].P1[0].Producer_FaxNumber_A[0]”=>@policy.client.broker.fax,
“F[0].P1[0].制作人\u联系人\u电子邮件地址\u 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]。通用性\u覆盖率指示器\u A[0]”=>1,
“F[0].P1[0].通用性\u发生指示器\u A[0]”=>1,
“F[0].P1[0].通用性\u通用聚合\u限制AppliesPerLocationIndicator\u A[0]”=>1,
“F[0].P1[0].Policy\u PolicyNumberIdentifier\u 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].保险公司全名[0]”=>“列克星敦保险公司”,
“F[0].P1[0].Insurance_NAICCode_A[0]”=>19437,
“F[0].P1[0].保险人全名\u B[0]”=>“工商保险公司”,
“F[0].P1[0].Insurance_NAICCode_B[0]”=>19410,
“F[0].P1[0].保险公司全名\u C[0]”=>“美国大保险公司”,
“F[0].P1[0].保险公司代码[0]”=>37532,
“F[0].P1[0].保险公司全名[0]”=>“海军上将保险公司”,
“F[0].P1[0].保险公司代码[0]”=>24856,
“F[0].P1[0].通用性\u保险公司莱特代码\u A[0]”=>“A”,
“F[0].P1[0].通用性\u每个发生\u限制金额\u A[0]”=>1000000,
“F[0].P1[0].通用性\u FireDamagerEntedEmissions\u each-ccurrence LimitAmount\u A[0]”=>50000,
“F[0].P1[0].通用性\u MedicalExpense\u EachPersonLimitAmount\u A[0]”=>“已排除”,
“F[0].P1[0].通用性\u个人和广告伤害\u限额\u A[0]”=>1000000,
“F[0].P1[0].通用性\u通用聚合\u有限金额\u A[0]”=>2000000,
“F[0].P1[0].通用性\u产品和完成的操作\u聚合极限\u A[0]”=>2000000,
“F[0].P1[0].车辆保险代码A[0]”=>“A”,
“F[0].P1[0].车辆租用自动指示器[0]”=>1,
“F[0].P1[0].车辆\u非自有自动指示器\u A[0]”=>1,
“F[0].P1[0].Policy\u PolicyNumberIdentifier\u 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]。车辆组合单限值每一意外装载量[0]”=>1000000,
“F[0].P1[0].除保险单承保代码A[0]”=>“B”,
“F[0].P1[0].异常风疹发生指示器\U A[0]”=>1,
“F[0].P1[0].除伞A[0]”=>1,
“F[0].P1[0].除雨伞和雨伞外,免赔额或免赔额免赔额免赔额免赔额免赔额免赔额[0]”=>@policy.coverage.first,
“F[0].P1[0].Policy\u PolicyNumberIdentifier\u 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].除雨伞外每种雨伞发生额[0]”=>10000000,
“F[0].P1[0].除伞式集合数量[0]”=>10000000
发送文件(“#{Rails.root}/acord25.pdf”,文件名:“#{@policy.client.name}-#{@policy.carrier.name}-#{@policy.policyNumber}(#{Time.now}).pdf”,键入:“application/vnd.ms excel”)
终止
终止
TL;DR:复选框在Chrome中显示,但在预览或邮件中不显示。


我感谢任何关于问题所在的帮助或线索。谢谢大家!

结果显示PDF表单已损坏。必须重新创建表单,而不是PDFTK问题。

否?如果我说“请”怎么办?