I’m trying to upload a pdf file into buffer. I was expecting to get in the console message either ‘get’ or ‘not’, but I get the message ‘undefined’…
In page code:
PDF_name = “https://ff4066b3-fa1e-4f83-866c-5d6548bfdbe3.usrfiles.com/ugd/ff4066_85749710b488467f98302a1ec22f8708.pdf” ;
export function btnUploadPDF_click(event) {
FillPDF( PDF_name , 'fields' ).then(msg =>{
console.log(msg);
})
. catch (error => {
console.log( 'error' );
});
}
In the backend file:
import rp from ‘request-promise’ ;
export function FillPDF (name, fields)
{
rp.get({ URL_path, encoding: null })
.then( (pdf_buf) => {
return ( ‘get’ );
// var out_buf = pdfform().transform(pdf_buf, fields); // next step will be fill the pdf file…
// uploadPDF( out_buf); Step after will be to upload the filled pdf file to UploadFolder…
})
. catch ( (err) => { return ( ‘not’ )})
}