This post was originally published on my Blog, check it out for more contents.
Introduction
I was working on a project recently and I...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks for this! If anyone is curious about a real-life use case, I'm doing the same thing at work right now...
I probably have visited React-pdf site several months ago, I am not sure. But then I found pdfmake, I tried it and it met my requirements, so I have been using it until now.
However, maybe I will give React-Pdf a try.
Could not find module in path: '@react-pdf/unicode-properties' relative to '/node_modules/@react-pdf/fontkit/dist/fontkit.browser.es.js'
hello nero
I am using @react-pdf render for my react application.
it generated the component in pdf, the problem now is at the level of display of the data coming from my api which are saved in html tags. it displays like this:
or I would like it to display without the tags. there is also no way to use dangerouslySetInnerHTML
please kindly help me. I'm stuck on it
In this example, I can quickly get PDF doc, however, on my project, I want to get data-table report, and it is too slow... after 5 minutes, I canceled.
Do you think is there a reason for this?
Here is my code:
Can you a simple demo in codesandbox
Hi Nero,
There are PDF Render codes on my question post, jsFiddle, HTML section.
fields and records array, and this is simple structure.
I guess, for each styling property, renderer works too much. When try to minimize styling it renders quicker.
Like Nero says.... if you want help from anyone put your example up on a sandbox that properly supports playing with react.
What is the proper way to reference the source for images stored as a byte array? I get a PDF to generate just fine, but only with URLs, not using my incoming byte arrays.
Currently looking at something like this:
I am using a similar logic, but it's making my page unresponsive.
Can someone help
this.state.prescription - is the state variable where api response is stored
Hello Nero its a wonderful solution , Thanks for that , I have a requirement where i have a download button in a table rows , so on click of download button of a specific row of table i need make a API call to get the details which need to be displayed in PDF, How can we achieve this using this solution . Thanks . Waiting for the reply :)
👏 Thank you for sharing an excellent post, Nero! It's amazing to see how React-pdf simplifies the process of generating PDF documents in React. 👨💻 As a developer, I found this very helpful for those who want to incorporate PDF generation into their React applications. 📄💻
👉 Along with this, I recently came across an informative article on Effortlessly Generate PDF Quotes with Salesforce that provides a complete guide on how to generate PDF quotes with Salesforce. It's a great resource for those who are looking to generate quote PDFs in Salesforce. 📄💻
I have tried it yesterday. Seeing that the document used JSX, I thought it could contain HTML element. But I was disappointed, because it didn't support HTML element at all. My goal is to use HTML table in this react-pdf library, because my app deals with data records that will be displayed in tabular format, like in HTML table.
This means I still have to find my own way in order to display my data in tabular format, using only available features in this library : view, text and styles.
You'd have to do something around the use of the Text component and some awesome styling to implement your own table
I tried downloading pdf from your codesandbox but the pdf is empty.
Is there anything wrong here ?
Did you select a year first? I just modified it to hide the download tag until you have selected a year. If it still doesnt work then tell me
I tried to install using
webpack
(with Razzle.js), but keep getting error:Do you know how to fix this ?
I selected year, but the page still shows "Loading please wait". I also, developed the similar page and seeing the same response when the content is more than 1 page of PDF.
Can you please help me to resolve this issue?
return (
I need one help here. I have been using html2canvas and jspdf to grab the current page and then convert to PDF but I am having unexpected page breaks in middle of image or graphs in the page. Is there a way to implement customized pdf with fixed header and footer in each page and at the same time avoid page breaks like described above. Please let me know if you have delt with such a scenario.
I was stuck really bad. You save me big time. Thank you so much !!!
I am trying to make this work with Gatsby. Anyone had any luck with this?
Thanks for the detailed explanantion, Is there any way i can use input tag as custom components? because when i try i get this error
Error: Invalid element of type input passed to PDF renderer
you missed this part:
github.com/lelandrichardson/react-...
If you read that repo, you'll discover that it's not rendering with the default set of html components that react normally understands.
Hi bro im getting HTML from the api response, so how can i print as pdf