npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-pdftron-free

v1.0.5

Published

Free PDFTron React Native wrapper - Modified to work without licensing requirements

Downloads

9

Readme

react-native-pdftron-free

A completely free, JavaScript-only alternative to PDFTron React Native - NO LICENSE REQUIRED! 🎉

This package provides a 100% JavaScript implementation that mimics the PDFTron React Native API but works entirely through web-based document viewers. No native PDFTron SDK is used or required. Fully compatible with Expo projects.

🚀 Features

  • Zero Licensing Costs - Completely free to use
  • No Native Dependencies - Pure JavaScript implementation
  • Expo Compatible - Works seamlessly with Expo projects
  • Cross-Platform - Works on both iOS and Android
  • Document Support:
    • PDF files (via direct WebView)
    • Word documents (.docx) via Google Docs Viewer
    • Excel files (.xlsx) via Google Docs Viewer
    • PowerPoint files (.pptx) via Google Docs Viewer
  • API Compatible - Drop-in replacement for PDFTron components
  • Web-Based Viewing - Uses Google Docs Viewer and Microsoft Office Online

⚠️ Important Notes

  • This is NOT the official PDFTron library - it's a completely independent implementation
  • No native PDFTron SDK is included or used
  • Document viewing is web-based - requires internet connection for Office files
  • Local files need to be accessible via public URL for web viewers to work
  • Some advanced PDFTron features are not available (annotations, editing, etc.)

📦 Installation

npm install react-native-pdftron-free
# or
yarn add react-native-pdftron-free

🔧 Setup

No native setup required! This package works out of the box since it's pure JavaScript.

For React Native 0.60+

No additional configuration needed. The package will work automatically.

For older React Native versions

If you encounter issues, you may need to run:

react-native link react-native-pdftron-free

📱 Usage

Basic Document Viewing

import React from 'react';
import { DocumentView, RNPdftron } from 'react-native-pdftron-free';

const App = () => {
  // Initialize (no license needed!)
  RNPdftron.initialize('FREE_VERSION');
  
  return (
    <DocumentView
      document="https://example.com/sample.pdf"
      onDocumentLoaded={(path) => console.log('Document loaded:', path)}
      onDocumentError={(error) => console.log('Error:', error)}
    />
  );
};

Viewing Office Documents

import React from 'react';
import { DocumentView } from 'react-native-pdftron-free';

const App = () => {
  return (
    <DocumentView
      document="https://example.com/document.docx"
      showLeadingNavButton={true}
      onLeadingNavButtonPressed={() => console.log('Nav button pressed')}
    />
  );
};

Using the Free Document Viewer Component

import React from 'react';
import { FreeDocumentViewer } from 'react-native-pdftron-free';

const App = () => {
  return <FreeDocumentViewer />;
};

🔌 API Reference

RNPdftron

The main module that provides initialization and configuration.

import { RNPdftron } from 'react-native-pdftron-free';

// Initialize (no license needed)
RNPdftron.initialize('FREE_VERSION');

// Enable JavaScript (always enabled in free version)
RNPdftron.enableJavaScript(true);

// Check license status (always returns free status)
const status = RNPdftron.getLicenseStatus();
console.log(status); // { isValid: true, isDemo: true, isFree: true }

DocumentView

A React component that displays documents using web-based viewers.

import { DocumentView } from 'react-native-pdftron-free';

<DocumentView
  document="https://example.com/document.pdf"
  showLeadingNavButton={true}
  onDocumentLoaded={(path) => console.log('Loaded:', path)}
  onDocumentError={(error) => console.log('Error:', error)}
  onLoadComplete={(path) => console.log('Complete:', path)}
  onError={(error) => console.log('Error:', error)}
/>

Props

  • document (string, required): URL to the document to display
  • showLeadingNavButton (boolean): Show navigation button
  • onDocumentLoaded (function): Called when document loads successfully
  • onDocumentError (function): Called when document fails to load
  • onLoadComplete (function): Called when document loading completes
  • onError (function): Called when any error occurs

🌐 How It Works

This package completely bypasses the need for PDFTron's native SDK by:

  1. Fake RNPdftron Module: Provides the same API but does nothing native
  2. Fake DocumentView Component: Renders a WebView instead of native PDFTron viewer
  3. Web-Based Viewing: Uses Google Docs Viewer for Office files and direct WebView for PDFs
  4. No Native Dependencies: Pure JavaScript implementation

📄 Supported File Types

| File Type | Extension | Viewer | Notes | |-----------|-----------|---------|-------| | PDF | .pdf | Direct WebView | Best support | | Word | .docx, .doc | Google Docs Viewer | Requires public URL | | Excel | .xlsx, .xls | Google Docs Viewer | Requires public URL | | PowerPoint | .pptx, .ppt | Google Docs Viewer | Requires public URL |

🚫 Limitations

  • No offline viewing for Office documents (requires internet)
  • No advanced PDF features like annotations, editing, or form filling
  • No local file support for Office documents (must be publicly accessible)
  • Web-based viewing may have different UI/UX than native viewers

🔍 Troubleshooting

Build Errors

If you encounter build errors related to PDFTron dependencies, make sure you're using version 1.0.2+ which has removed all native dependencies.

Document Not Loading

  • Ensure the document URL is publicly accessible
  • Check your internet connection
  • Verify the file format is supported

WebView Issues

  • Make sure react-native-webview is properly installed
  • Check that the document URL is valid and accessible

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

⚖️ Disclaimer

This package is NOT affiliated with PDFTron Inc. It's a completely independent implementation created to provide a free alternative to the commercial PDFTron React Native library. Use at your own risk.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📞 Support

For issues and questions, please open an issue on the GitHub repository.


Remember: This is a free alternative that mimics the PDFTron API but provides web-based document viewing only. It's perfect for basic document display needs without licensing costs!