(06) ProjectOpen-source npm package

react-base64-to-pdf

A React component library for showing details about, previewing and downloading Base64-encoded PDF files.

Role
Author & maintainer
Context
Open-source npm package
Stack
React, TypeScript, npm
The react-base64-to-pdf package page on npm
(01)Overview

Overview

An npm package that makes it easy to work with Base64-encoded PDF files in React. I built it because the existing packages didn't offer a reliable, flexible viewer for this format.

It gives React apps three components: one shows a PDF's details, one previews its content in the page, and one downloads it with a single click.

(02)Components

Components

  1. 01

    PDFInfo

    Shows the file size, PDF version, creation and modification dates, and the tool used to create it.

  2. 02

    PDFPreview

    Renders the PDF inside the app, with optional style and className props for custom styling.

  3. 03

    PDFDownloadButton

    A download button with an optional file name (defaults to file.pdf) and custom styles.

(03)Using it

Using it

  1. 01

    Install

    npm install react-base64-to-pdf

  2. 02

    One required prop

    Every component takes a base64 string. Styling props are optional.

  3. 03

    Open source

    MIT licensed, with the source on GitHub.