Updated 5 May 2021
In this blog, we are going to generate PDF file with the HTML string by using react-native HTML to pdf. So let’s get started.
We are using react-native-html-to-pdf to generate the PDF file from the HTML click here to check the npm page.
We just need the HTML string by the help of it we can generate the PDF.
You just have to run the below mentioned command to install the npm module.
–> npm i react-native-html-to-pdf
After that, we need to link the dependency by run the below-mentioned command.
–> react-native link
There is two way to link your libraries First is above it is automatic by run react-native link it will automatically link your libraries and the second one is manual.
IOS :
libRNHTMLtoPDF.a
to Build Phases -> Link Binary With Libraries
Android :
android/settings.gradle
to includedandroid/app/build.gradle
file to includeMainApplication.java
to includeWRITE_EXTERNAL_STORAGE
permission to AndroidManifest.xml
So here our setup has been completed now let’s do some code. For instance, I have code to generate an html invoice to PDF.
In conclusion, we will get the pdf file in file.
I hope it will help you.
After that, you can check out my other blogs by clicking here.
Reference link:- https://www.npmjs.com/package/react-native-touch-id ,
PermissionsAndroid:- http://reactnative.dev/docs/permissionsandroid
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.