Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

179
Vistas
How to print/save pdf in react native?

I have a screen where all the information related to user and their tasks will be displayed.. It's like a report. At the end I have a button for the user clicking on which will allow them to save a pdf version of the same information. The information will be different every time.. So the number of rows will be different. How can this be achieved? I tried using react-native-html-to-pdf but I could create pdf of only static html.. Couldn't figure out how to render dynamic html? The ui will be slightly different for the pdf compared to the screen but the information will be same.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

From what I see in the post linked above, the following piece of code looks like an html string that you can modify as desired (sync or async regardless):

const printPDF = async () => {
    const results = await RNHTMLtoPDF.convert({
      html: '<h1>Demo Text to converted to PDF</h1>',
      fileName: 'test',
      base64: true,
    });
    await RNPrint.print({filePath: results.filePath});
  };

It looks like that text can be dynamically changed, so you can replace it with any function:

const printPDF = async () => {
    const htmlString = await buildDynamicHtml();
    const results = await RNHTMLtoPDF.convert({
      html: htmlString,
      fileName: 'test',
      base64: true,
    });
    await RNPrint.print({filePath: results.filePath});
  };
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda