篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript FDA digi标志相关的知识,希望对你有一定的参考价值。
import { nopodofo as npdf, NPDFAnnotationFlag, NPDFAnnotation, pdfDate } from 'nopodofo'
const doc = new npdf.Document()
console.log(doc);
doc.load('./FDA.pdf', e => {
console.log(e);
const rect = new npdf.Rect(0, 0, 10, 10),
page = doc.getPage(0),
annot = page.createAnnotation(NPDFAnnotation.Widget, rect)
// This signature is going to be hidden, for a visible signature add an appearance stream
annot.flags = NPDFAnnotationFlag.Hidden | NPDFAnnotationFlag.Invisible
const field = new npdf.SignatureField(annot, doc)
// Set field properties
field.setReason('test')
field.setLocation('here')
field.setCreator('me')
field.setFieldName('signer.sign')
// This will set the date as now
field.setDate()
// or create a new date and pass to the setDate function
let d = new npdf.Date(pdfDate(new Date('2012-12-12')))
field.setDate(d)
const signer = new npdf.Signer(doc, './output/')
signer.signatureField = field
signer.loadCertificateAndKey('certificate.p12', 'withpass.p12', (error, signatureLength) => {
if (error) { /* handle error */ }
signer.write(signatureLength, (e, d) => {
if (e) { /* handle error*/ }
// signed document has been written to /output/path provided in Signer constructor
})
})
})
以上是关于javascript FDA digi标志的主要内容,如果未能解决你的问题,请参考以下文章