Why We Built a Production-Ready React Native PDF Library - @flitzinteractive/react-native-nitro-html-pdf

Built by Flitz Interactive for real production React Native applications, this PDF library delivers reliable multi-page documents with proper headers, footers, and pagination.

Why We Built a Production-Ready React Native PDF Library - @flitzinteractive/react-native-nitro-html-pdf
Dhruv Patel
Post By
Dhruv Patel

React Native PDF Generation: Why We Built This Library

If you're building a React Native application that requires PDF generation, you've probably used react-native-html-pdf.

While it worked for simple documents, it lacked essential production features like:

  • Repeating headers and footers
  • Page numbering
  • Proper multi-page support
  • Professional document formatting

For business apps generating invoices, contracts, reports, and receipts, these limitations became blockers.

Why We Built @flitzinteractive/react-native-nitro-html-pdf

While building production React Native applications at Flitz Interactive, we needed reliable, professional PDF generation for:

  • Invoices
  • Contracts
  • Financial statements
  • Multi-page reports

The existing solution, react-native-html-pdf, worked for simple exports - but failed for real business use cases.

The Breaking Points

  • Headers only appeared on the first page - Making it impossible to create professional multi-page documents
  • No support for repeating footers - Business documents require consistent footers across all pages
  • No built-in pagination - No way to add page numbers or track total pages
  • Poor multi-page handling - Content would break unpredictably across pages
  • Limited control over layout - Margin control and page size options were restrictive

We tried workarounds. We tried hacks. We tried patching. Nothing worked reliably for production-grade apps.

So instead of stacking hacks on top of limitations, we rebuilt the entire approach using Nitro Modules and native rendering APIs.

We didn't build this as an experiment. We built it because we needed it in real client applications.

And if you're facing the same challenges - this library was built for you.

Introducing @flitzinteractive/react-native-nitro-html-pdf

@flitzinteractive/react-native-nitro-html-pdf is a high-performance React Native PDF generation library built on Nitro Modules architecture.

It solves the biggest limitations of traditional HTML-to-PDF libraries in React Native.

Core Features

  • Repeating Headers and Footers - Headers and footers appear on every page, exactly as they should
  • Automatic Pagination - Built-in page numbering with customizable formats (Page X of Y)
  • Vector-Based PDFs - Text remains selectable and searchable
  • Multiple Page Sizes - A4, A3, A5, Letter, Legal
  • Flexible Margins - Full control over all margins
  • Cross-Platform - Works seamlessly on iOS and Android
  • High Performance - Powered by Nitro Modules for native speed
  • No Backend Required - Works offline
  • Privacy-First - No data sent to servers
  • Zero Cloud Costs - Local PDF generation

How It Works

The library uses native platform APIs to ensure the highest quality output:

  • Android: Uses PrintDocumentAdapter with PDFBox for vector rendering
  • iOS: Uses UIPrintPageRenderer with native PDF context drawing

Both platforms ensure that text remains selectable and the output is truly vector-based, not rasterized images.

Real-World Example: Invoice PDF Generation in React Native

Here's how to generate a multi-page invoice PDF with headers, footers, and page numbers:

import { generatePdf } from '@flitzinteractive/react-native-nitro-html-pdf';

const result = await generatePdf({
  html: invoiceHtml,
  fileName: 'invoice-12345.pdf',
  pageSize: 'A4',
  header: '<div>Your Company Name</div>',
  headerHeight: 100,
  footer: '<div>Thank you for your business!</div>',
  footerHeight: 80,
  showPageNumbers: true,
  pageNumberFormat: 'Page {page} of {total}',
});

Why This Is Better Than react-native-html-pdf

Unlike react-native-html-pdf, our library provides:

1. True Multi-Page Support: Headers and footers repeat correctly across all pages - no workarounds, no hacks. It just works.

2. Built-In Pagination: Add dynamic page numbers using formats like "Page {page} of {total}".

3. High Performance with Nitro Modules: Built using native modules for optimal performance - even for large documents (100+ pages).

4. Production-Ready Output: Vector-based rendering ensures text is selectable, documents are searchable, files are lightweight, and print quality is professional.

5. Smart Margin Management: The library automatically calculates content area to prevent overlap.

6. Developer Experience: Intuitive and type-safe API with clear TypeScript interfaces.

Who Should Use This Library?

  • SaaS applications generating invoices
  • Fintech apps creating statements
  • E-commerce apps generating receipts
  • ERP and internal tools
  • Legal or contract management apps

Use Cases

This library is perfect for invoices and receipts, multi-page reports, contracts, certificates, statements, and tickets.

Getting Started

Install now:

npm install @flitzinteractive/react-native-nitro-html-pdf react-native-nitro-modules

⭐ If this library helps you, consider starring it on GitHub.

Check out the full documentation for detailed API reference and examples.

Conclusion

@flitzinteractive/react-native-nitro-html-pdf solves the critical limitations of react-native-html-pdf by providing true multi-page support with repeating headers, footers, and pagination. Built on modern Nitro Modules architecture, it delivers professional-quality PDFs with native performance.

If you've been struggling with PDF generation in React Native, give it a try. We built it because we needed it in real client applications, and we hope it helps you build better apps.

Links