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

380
Views
Cómo convertir HTML a PDF y compartir el archivo pdf con expo react native share (ios) con printToFileAsync

Puedo generar el pdfBuffer enviando el HTML al backend, pero recibir los datos y compartirlos con expo share es donde estoy atascado. Realmente aprecio por cualquier ayuda.

La lib que estoy usando es

 var pdf = require('html-pdf')

https://github.com/marcbachmann/nodo-html-pdf

Probé el siguiente código y busqué en Google durante 4 días sin prevalecer.
frontend reaccionar código nativo

 const createPdf = () => { const html = insertHtml(orders) axios('http://573f-98-14-177-227.ngrok.io/api/createPdf', { method: 'post', data: { html }, responseType: 'json', }) .then((res) => { console.log('pdf ', res.data) sharePdf(res.data) }) .catch(function (error) { console.log('err ', error) }) Alert.alert('Ordered Success', 'press ok to save a copy', [ { text: 'Ok', onPress: () => {}, style: 'cancel', }, { text: 'Cancel', style: 'cancel', }, ]) props.resetOrder() setOrders([]) }

Nodo backend para crear el pdf.

 router.post('/createPdf', (req, res) => { const {html} = req.body pdf.create(html).toBuffer((err, buffer) => { res.setHeader('Content-Length', buffer.length) res.setHeader('Content-type', 'application/pdf') var pdfBuffer = new Buffer.from(buffer) res.send(pdfBuffer) console.log('buffer ', pdfBuffer) }) pdf.create(html).toStream((err, pdfStream) => { if (err) { console.log(err) return res.sendStatus(500) } else { res.statusCode = 200 pdfStream.on('end', () => { return res.end() }) pdfStream.pipe(res) } }) })

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!