Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-base64-to-pdf
Advanced tools
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head>
A React component library for displaying, previewing, and downloading Base64-encoded PDF files. Easily integrate PDF viewing capabilities into your React applications.
You can install the package using npm:
npm install react-base64-to-pdf
Here’s a quick example of how to use the react-base64-to-pdf
library in your React application.
import React, { useEffect, useState } from "react";
import { PDFInfo, PDFPreview, PDFDownloadButton } from 'react-base64-to-pdf';
const App = () => {
const base64Pdf = 'JVBERi0xLjUKJYCBgoMKMSA.....'; // Your Base64-encoded PDF string
return (
<div>
<h1>PDF Viewer Example</h1>
{/* Show PDF Information */}
<PDFInfo base64={base64Pdf} />
{/* Download PDF Button */}
<PDFDownloadButton
base64={base64Pdf}
downloadFileName="your-file.pdf"
style={{
backgroundColor: 'blue',
color: 'white',
padding: '10px 20px',
borderRadius: '5px',
textDecoration: 'none'
}}
/>
</div>
);
};
export default App;
Displays the information of the PDF file such as file size, PDF version, creation date, modification date, and creator tool.
base64
(string): The Base64-encoded PDF string.showDownloadButton
(boolean): (Optional) Whether to display the download button. Default is false
.showPreview
(boolean): (Optional) Whether to show the PDF preview. Default is false
.Renders a preview of the PDF file.
base64
(string): The Base64-encoded PDF string.Provides a button to download the PDF file.
base64
(string): The Base64-encoded PDF string.downloadFileName
(string): (Optional) The name of the downloaded file. Default is file.pdf
.style
(React.CSSProperties): (Optional) Custom styles for the button.className
(string): (Optional) Custom class names for additional styling.This project is licensed under the MIT License. See the LICENSE file for details.
For any inquiries or feedback, feel free to reach out at 28priyanshu2001.
FAQs
A React library for rendering Base64-encoded PDF files and providing download options.
We found that react-base64-to-pdf demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.