react-base64-to-pdf
About the Project
Package Overview
I developed an npm package called react-base64-to-pdf to simplify handling Base64-encoded PDF files in React applications. This package was born from the need for a reliable, flexible PDF viewer that was missing in existing packages, making it easier to integrate PDF functionality directly into React projects.
react-base64-to-pdf is a React component library designed for:
- Displaying PDF Information: View file size, PDF version, creation date, and more.
- Previewing PDF Content: Render PDF content directly within the application for seamless in-app viewing.
- Downloading PDFs: Enable users to download PDF files with a single click.
Components
PDFInfo
- Description: Displays core information about the PDF file, like its file size, version, creation and modification dates, and the creation tool.
- Props: base64 (string): The Base64-encoded PDF string.
PDFPreview
- Description: Renders a preview of the PDF file, allowing users to view the content directly in the app.
Props:
- base64 (string): The Base64-encoded PDF string.
- style (React.CSSProperties, optional): Allows custom styling for the preview.
- className (string, optional): Additional CSS class names for further styling.
Description: Provides a button to download the PDF, with customizable options for user-friendly downloading.
Props:
- base64 (string): The Base64-encoded PDF string.
- downloadFileName (string, optional): The name for the downloaded file; defaults to 'file.pdf' if not provided.
- style (React.CSSProperties, optional): Custom styles for the button.
- className (string, optional): Additional CSS class names.
This package is ideal for any React application needing an efficient and user-friendly way to view, preview, and download PDF files, all from Base64 encoding.
Technologies Used
ReactTypescriptNode.jsNpm
Image Gallery