【发布时间】:2020-02-27 22:17:27
【问题描述】:
我们正在使用 npm 包 pdffiller 用我们的数据填充 PDF。在 1 个 PDF 上,我们将复选框的导出值设置为“是”,并且它可以很好地选中这些框。另一方面,我们也做了同样的事情,但它没有选中这些框。
我附上 PDF。请注意,我们只测试几个复选框开始。请参阅第 1 页申请人信息下名为 business.entityType.LLC 的字段(LLC 选项)。我们已经对此进行了一些测试,但这是一个简单的示例。
https://joncorrin.s3-us-west-2.amazonaws.com/Acord_125.pdf
这是我们传递给 pdffiller 的对象示例,其中 Yes 作为数据值(这应该会导致检查)
{
'business.entityType.LLC': 'Yes',
'business.businessType.Service': 'Yes',
'business.entityStartDate': '09/01/2017',
'business.isOtherEntity': 'No',
'business.hasOtherSubsidiaries': 'No',
'business.hasSafetyProgram': 'No',
'business.buildingHasDangerousMaterial': 'No',
'business.hasOtherInsuranceWithCompany': 'No',
'business.hasCancelled': 'No',
'business.hasHadMisconductClaims': 'No',
'business.hasBeenConvicted': 'No',
'business.hasSafetyViolations': 'No',
'business.hadBankruptcy': 'No',
'business.hadLien': 'No',
'business.hasTrust': 'No',
'business.hasForeignOperations': 'No',
'business.hasOtherVentures': 'No'
}
这是我们创建对象后pdffiller代码的核心
// actual code:
await pdfFiller.fillForm(filePath, filledPdfFilePath, filledObj, async (pdfErr) => {
if (pdfErr) return next(Boom.badRequest(pdfErr));
const streamBuffer = await fs.readFileSync(filledPdfFilePath);
await fs.unlinkSync(filePath);
await fs.unlinkSync(filledPdfFilePath);
res.send(Buffer.from(streamBuffer, 'binary'));
});
【问题讨论】:
标签: javascript node.js forms pdf fdf