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

183
Views
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 answers
Answer question

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 Report
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!