Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@config-plugins/react-native-pdf

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@config-plugins/react-native-pdf

Config plugin to auto configure react-native-pdf on prebuild

  • 9.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

config-plugins/react-native-pdf

Consider using a WebView or WebBrowser to quickly display a PDF in your app. Read the alternatives section to learn more.

Config plugin to auto-configure react-native-pdf when the native code is generated (npx expo prebuild).

Versioning

Ensure you use versions that work together!

exporeact-native-pdf@config-plugins/react-native-pdf
52.0.06.7.69.0.0
51.0.06.7.58.0.0
50.0.06.7.47.0.0
49.0.06.7.16.0.0
48.0.06.6.25.0.0

Add the package to your npm dependencies

This package cannot be used in the "Expo Go" app because it requires custom native code.

First install the package with yarn, npm, or npx expo install.

npx expo install react-native-pdf react-native-blob-util @config-plugins/react-native-pdf @config-plugins/react-native-blob-util

After installing this npm package, add the config plugin to the plugins array of your app.json or app.config.js:

{
  "plugins": [
    "@config-plugins/react-native-blob-util",
    "@config-plugins/react-native-pdf"
  ]
}

Next, rebuild your app as described in the "Adding custom native code" guide.

Alternatives

Consider opening a WebBrowser to display a PDF:

import * as WebBrowser from "expo-web-browser";
import { Text } from "react-native";

export default function HomeScreen() {
  return (
    <Text
      onPress={() => {
        WebBrowser.openBrowserAsync(
          "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
        );
      }}
    >
      Open in-app browser
    </Text>
  );
}

Or inside a WebView for a contained view:

import { WebView } from "react-native-webview";

export default function HomeScreen() {
  return (
    <WebView
      style={{ width: 100, height: 100 }}
      source={{
        uri: "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
      }}
    />
  );
}

Alternatively, if users have a favorite PDF viewer app than consider using Share API to let users open the PDF in their preferred app. This is akin to how UIDocumentInteractionController is intended to be used on iOS.

Finally, you could use DOM Components for a custom web experience.

Keywords

FAQs

Package last updated on 03 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc