问题
I'm running into an issue where I'm trying to combine a bunch of PDFs via a Cloud Function and then have that merged PDF be downloaded to the user's computer.
I have a function in my provider that calls the cloud function and passes an array of URLs that point to the pdfs like so:
mergePDFs(pdfs) {
// Create array of URLs that point to PDFs in Firebase storage
let pdfArr = [];
for(let key in pdfs) {
pdfArr.push(pdfs[key].url);
}
// Call Firebase Cloud function to merge the PDFs into one
this.http.get('https://us-central1-rosebud-9b0ed.cloudfunctions.net/mergePDFs', {
}).subscribe(result => {
console.log('merge result?', result);
});
}
Has anyone had any success utilizing pdf-merge NPM module to accomplish this?
I have a basic cloud function stubbed like so:
exports.mergePDFs = functions.https.onRequest((request, response) => {
cors(request, response, () => {
console.log('request', request);
response.status(200).send('test');
})
});
Though when I try to call it, I get error code 500 just so I can see if it's being called.
Has anyone else gotten the pdf merging functionality working via nodejs/Cloud Functions for Firebase?
来源:https://stackoverflow.com/questions/44128075/cloud-functions-for-firebase-merge-multiple-pdfs-into-one-via-nodejs-cloud-fun