React Native Html To Pdf screenshot

React Native Html To Pdf

Author Avatar Theme by Christopherdro
Updated: 4 Sep 2025
459 Stars

Convert html strings to PDF documents using React Native

Categories

Overview:

React-native-html-to-pdf is a library that allows users to convert HTML strings to PDF documents using React Native. This tool simplifies the process of generating PDFs from HTML content for mobile applications.

Features:

  • Automatic linking with react-native link
  • Manually integrate for iOS and Android
  • Customizable filename and output directory
  • Option to return base64 string of PDF file
  • Adjustable document dimensions for height and width
  • Customizable padding for iOS
  • Custom font integration for Android
  • Dynamic permission handling for Android M and above

Installation:

To install the react-native-html-to-pdf library, you can follow these steps:

  1. Run npm install react-native-html-to-pdf --save in your project directory.

  2. For automatic linking, run react-native link.

  3. For manual integration on iOS:

    • Add libRNHTMLtoPDF.a to Build Phases -> Link Binary With Libraries in XCode.
    • Update android/settings.gradle and android/app/build.gradle.
    • Adjust MainApplication.java and AndroidManifest.xml as mentioned.
  4. For Android-specific font customization, provide an array of custom fonts in the appropriate format.

Summary:

React-native-html-to-pdf is a versatile tool for React Native developers to convert HTML strings to PDF documents effortlessly. With features like automatic and manual integration, customizable output options, and platform-specific settings, this library offers flexibility and ease of use for PDF generation in mobile applications.