You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varfgen=uuidv4()+'.docx';varpre='<w:p><w:r><w:t>';varpost='</w:t></w:r></w:p>';varlineBreak='<w:br/>';varstr=signaturex.content.replace("\n",lineBreak);req.body.signature_text=pre+str+post;dispo.generateDocx(dispo.docTypeFolder()+docType.fileName,req.body,fgen);//dispo.js//generate doc from doc typeexports.generateDocx=function(templateDocx,fieldValues,resultDocx){//Load the docx file as a binaryvarcontent=fs.readFileSync(templateDocx,'binary');varzip=newJSZip(content);vardoc=newDocxtemplater();doc.loadZip(zip);//set the templateVariablesdoc.setData(fieldValues);try{// render the document (replace all occurences of {first_name} by John, {last_name} by Doe, ...)doc.render()}catch(error){vare={message: error.message,name: error.name,stack: error.stack,properties: error.properties,}console.log(JSON.stringify({error: e}));// The error thrown here contains additional information when logged with JSON.stringify (it contains a property object).throwerror;}varbuf=doc.getZip().generate({type: 'nodebuffer'});// buf is a nodejs buffer, you can either write it to a file or do anything else with it.fs.writeFileSync(path.resolve(config.generated_docx_folder,resultDocx),buf);}
the signaturex.content variable is plain text:
a.n. Rektor,
Kepala Biro AUAK IAIN Tulungagung
Environment
How to reproduce my problem :
My template is the following : https://drive.google.com/file/d/1uz4l5Dw4vsmG73RXLDO1xKukoJwqBvnW/view?usp=sharing
With the following js file :
the signaturex.content variable is plain text:
a.n. Rektor,
Kepala Biro AUAK IAIN Tulungagung
(Tanda Tangan dan Cap Dinas)
Nama Lengkap
NIP.
=============================
its working but the font family changed to times new roman and the text position is changed to the left side, please check the result doc at https://drive.google.com/file/d/1SotE0XTYXSzb1y8mzMvy8ijLNP1xbCj_/view?usp=sharing
Thanks
The text was updated successfully, but these errors were encountered: