Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
el cifrado de pdf y la carga de aws S3 no funcionan

En este código, estoy tratando de crear un archivo pdf y cifrarlo, puedo crear un cifrado pdf, en este código estoy creando un Tempfile en mi máquina local, luego estoy cifrando ese archivo y aquí ' qpdf --encrypt Decorpot test 40 -- ${tempFileName} --replace-input ' solo estoy reemplazando el archivo no encriptado con un archivo encriptado y se almacena correctamente como un archivo encriptado en la máquina local, pero cuando voy a cargar en s3 aws solo archivo no encriptado está agregado. Probé tantos métodos... por favor ayúdenme... Gracias

 module.exports.generateChecklistPdf2 = function () { return new Promise((resolve, reject) => { let htmlFilePath = ''; htmlFilePath = path.join(__dirname, '../static/html/checkList.html'); htmlFilePath = htmlFilePath.replace(new RegExp(/\\/g), '/'); pdfFilePath = path.join(__dirname, '../uploads/' + Math.ceil(Math.random() * 810000) + '.pdf'); pdfFilePath = pdfFilePath.replace(new RegExp(/\\/g), '/'); let date = new Date(); return ejs.renderFile(htmlFilePath, { moment: moment, date }, {}, function (err, htmlFile) { if (err) return console.log(err); var tempFileName = pdfFilePath; var file = fs.createWriteStream(tempFileName); assetsPath = path.join(__dirname, '../static/'); assetsPath = assetsPath.replace(new RegExp(/\\/g), '/'); options = { base: 'file:///' + assetsPath, } setTimeout(() => { var cmd = `qpdf --encrypt Decorpot test 40 -- ${tempFileName} --replace-input`; exec(cmd, function (err) { if (err) { console.error('Error occured: ' + err); } else { console.log('PDF encrypted :)', tempFileName); } }); }, 1000) return pdf.create(htmlFile, options).toStream(function (err, stream) { stream.pipe(file).on('close', () => { formData = { customerName: "customername", file: fs.createReadStream(pdfFilePath) } let url = ''; if (process.env.NODE_ENV == 'production') { url = 'http://13.233.26.162:5003/api/file/upload'; } else { url = 'http://localhost:5003/api/file/upload'; } return request.post({ url: url, formData: formData }, function (err, res) { if (err) return console.log(err); console.log(res.body) let resolveObject = {}; resolveObject.pdfUrl = res.body; resolve(resolveObject); }); }); }); }); }); }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!