惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
Jina AI
Jina AI
博客园_首页
宝玉的分享
宝玉的分享
The Cloudflare Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
量子位
T
Tailwind CSS Blog
雷峰网
雷峰网
Blog — PlanetScale
Blog — PlanetScale
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
月光博客
月光博客
罗磊的独立博客
F
Fortinet All Blogs
酷 壳 – CoolShell
酷 壳 – CoolShell
Stack Overflow Blog
Stack Overflow Blog
J
Java Code Geeks
V
V2EX
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The GitHub Blog
The GitHub Blog
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 聂微东
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Docker
阮一峰的网络日志
阮一峰的网络日志
I
InfoQ
Simon Willison's Weblog
Simon Willison's Weblog
D
DataBreaches.Net
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
Intezer
Scott Helme
Scott Helme
B
Blog
M
MIT News - Artificial intelligence
K
Kaspersky official blog
H
Help Net Security
V
Vulnerabilities – Threatpost
C
CXSECURITY Database RSS Feed - CXSecurity.com
Engineering at Meta
Engineering at Meta
博客园 - 【当耐特】
L
Lohrmann on Cybersecurity
P
Privacy & Cybersecurity Law Blog
Project Zero
Project Zero
The Hacker News
The Hacker News
B
Blog RSS Feed
T
Tor Project blog

Inside Nutrient

A guide to the invisible work behind documents Introducing Nutrient Documents for Salesforce: Native document generation and signing Document AI vs. traditional OCR: Choosing between OCR, AI, and hybrid pipelines PDF SDK compliance and security evaluation checklist for enterprise teams (2026) Invariant Corp replaces paper processes with Nutrient Workflow and scales without limits What is process mapping? A complete guide Nutrient vs. Conga Composer for Salesforce document generation (2026) Document routing: How to automate document distribution The CTO’s AI playbook: Why accountability architecture beats orchestration Compliance workflow automation: Why built-in compliance is table stakes Workflow diagrams: Examples, symbols, and how to build one that actually runs Digital forms: Replace paper forms with automated workflows Approval workflow software: How to automate approvals Why document-centric automation is different The CEO’s AI playbook: Why decision architecture beats model selection Nutrient SDK product updates for Q1 2026 PDF redaction verification: How to prove sensitive data is permanently removed What is a VPAT? The complete guide to accessibility conformance reports What is PDF/UA? The accessible PDF standard explained Salesforce eSignatures: Generate, sign, and track documents in one flow Online document viewer: Options, tradeoffs, and how to embed one Document viewer for web apps: React, Vue, Angular (2026) Best document viewers in 2026: A buyer’s guide How to edit a PDF in Python: Add text, images, and annotations Nutrient advances Workflow platform with agentic AI for enterprise-grade speed and consistency in document-heavy operations How to create a Salesforce quote template from opportunity data The business case for accessibility: Five ways it drives enterprise value Python PDF library comparison (2026): 7 libraries for developers Why your AI agent hallucinates PDF table data PDF.js limitations: When to upgrade to a commercial PDF SDK How Subject scaled 5× with Nutrient’s PDF SDK without rebuilding its document layer I replaced our sales training with an AI coach that runs in Slack — here’s what broke Redirecting to: https://securitybuzz.com/cybersecurity-news/why-enterprise-permissions-are-ais-most-dangerous-inheritance/ Nutrient .NET SDK vs. iText Core: Complete comparison for .NET developers DocuVieware: Support’s most frequently asked setup questions Introducing Nutrient Workflow How to convert PDF to Word in C# (.NET) When email and spreadsheets stop working: Work order approval workflows for field teams on the move Compliance with confidence: Why document-centric automation is the foundation of your mission Nutrient expands AI Assistant, automating multistep document workflows inside any application What is document generation? A developer’s guide to PDF generation Document Converter data flow and how real-time watermarks skip the queue PDF/UA compliance guide: Requirements, standards, and best practices Computers still can’t understand you How Athena Intelligence built AI agents for regulated enterprises with Nutrient’s document infrastructure How to convert HTML to PDF (2026): 4 methods from browser print to SDK How to build a document extraction pipeline with Nutrient Vision API OCR vs. intelligent document processing: Choosing the right document extraction engine Beyond OCR: How document intelligence eliminates manual processing in regulated industries Nutrient vs. IronPDF: Complete comparison for .NET developers Nutrient vs. Aspose.PDF: Complete comparison for .NET developers Redirecting to: https://fortune.com/2026/02/19/openclaw-who-is-peter-steinberger-openai-sam-altman-anthropic-moltbook/ Lufthansa Systems uses Nutrient to deliver reliable, scalable PDF rendering for pilots worldwide Nutrient vs. Syncfusion: Complete comparison for .NET developers React’s useTransition: The hook you’re probably using wrong First City Monument Bank streamlines banking processes with Nutrient Workflow Redirecting to: https://www.sdcexec.com/warehousing/automation/article/22957364/nutrient-workflow-automation-the-missing-link-in-supply-chain-efficiency The complete guide to digital signatures: PAdES, CAdES, and XAdES explained Nutrient Python SDK: Production-grade document processing for Python Introducing agentic document editing for web applications with AI Assistant Nutrient vs. QuestPDF: Complete comparison for .NET developers How we fixed the GdPicture license expiration (and what to do if you’re affected) Red team security testing with agentic AI The future of healthcare document automation Best healthcare workflow software compared Nutrient SDK product updates for Q4 2025 How Harvey scaled legal document workflows 50 percent MoM without rebuilding infrastructure HIPAA-compliant document management in hospitals How we optimized rendering performance while handling thousands of annotations in React — Part 2 Automated PII removal with Nutrient API Redirecting to: https://www.devopsdigest.com/2026-low-code-no-code-predictions Redirecting to: https://www.kmworld.com/Articles/Editorial/ViewPoints/Leaders-predict-AI-to-continue-permeating-all-aspects-of-KM-in-2026-172594.aspx What are deep agents and how do they solve complex problems? Whipping up document magic: Your easy-bake recipe for Vue and Nutrient Web SDK 🧁 What I’ve learned about product iteration planning while building SDKs Passwordless document signing: Three-layer security guide New zip folder functionality streamlines file management in Document Automation Server The keyboard shortcuts playbook: Taking control of keyboard events in Nutrient Web SDK From experienced engineer to AI beginner: My unexpected journey AI-assisted manual testing: Handling Safari’s PDF rendering and UI quirks How to keep a 20-year-old SDK up to date How we optimized rendering performance while handling thousands of annotations in React — Part 1 Nutrient announces new executive hires to accelerate next phase of growth High performance UI using web workers Automate document conversion at scale with Python and Nutrient DCS From curiosity to PLG (and AI): My journey to understanding product-led growth Prost to progress: One year as Nutrient Pigeon usage at Nutrient: Bridging native SDKs to Flutter Modernizing CI build servers: How to migrate from Chef to Ansible Unix man pages: AI-friendly documentation since 1971 Consistent hashing for even load distribution Best AI redaction APIs: Complete comparison guide for 2025 Why AI document redaction matters for modern security From coding to coordinating: How AI transformed my workflow What is intelligent document processing (IDP)? A complete guide Enterprise PDF SDKs: Best PSPDFKit (now Nutrient) alternatives Nutrient SDK product updates for Q3 2025 GdPicture support best practices Redacting sensitive data with Nutrient AI redaction API How AI is transforming the customer experience at Nutrient: From instant answers to intelligent support
How to export to PDF using React
Hulya Masharipov · 2024-06-04 · via Inside Nutrient

Table of contents

    How to export to PDF using React

    Summary

    This tutorial demonstrates how to add PDF export functionality to React applications using jsPDF for basic client-side PDF generation from content and text. The guide covers setting up a Remix project, creating PDF export functions, and triggering downloads with customizable styling options. It also introduces Document Engine as an advanced solution for enterprise-grade PDF generation with HTML and CSS templates, offering greater design flexibility and control over document layouts.

    This blog post will guide you through adding PDF export functionality to your React applications. You’ll learn how to set up your project and choose between jsPDF for basic PDF generation and Nutrient for advanced PDF solutions.

    Why export to PDF in React?

    Exporting content to PDF in a React application has a wide range of use cases:

    • Reports and invoices — Generate printable invoices and detailed reports for users.
    • Data visualization — Create PDFs of charts, graphs, and dashboards for presentations or sharing insights.
    • Document management — Allow users to save and share web content as PDFs for documentation purposes.
    • Resume builder — Let users generate a professional-looking resume from their online profiles.
    • Content archiving — Archive web pages, articles, and blog posts as PDFs for offline reading.

    Now that you understand the importance of PDF export in React, it’s time to dive into the implementation.

    Requirements

    Before beginning, make sure you have the following installed:

    Step 1 — Initializing a Remix project

    To set up a Remix(opens in a new tab) project, you’ll need to initialize a new project.

    1. Install the Remix CLI globally (if you haven’t already):

      npm install -g create-remix

    2. Use the Remix CLI(opens in a new tab) to create a new Remix project:

    Follow the prompts to set up your Remix project. You can choose the default options.

    Step 2 — Choosing a PDF generation library

    To export content to PDF in React, you’ll need a PDF generation library. One popular choice is jsPDF(opens in a new tab). Install it in your project by running the following:

    Step 3 — Creating a PDF export function

    Now you can create a function that generates a PDF from the content you want to export. Here’s a simple example using jsPDF:

    // In case `src` directory is not created by default, manually create it

    // using `src/utils/exportToPDF.js`.

    import jsPDF from "jspdf";

    export const exportToPDF = (content) => {

    const doc = new jsPDF();

    doc.text(content, 10, 10); // Add content to the PDF.

    doc.save("exported-content.pdf"); // Save the PDF with a file name.

    };

    This code sets up a basic PDF document and adds the content you pass to it. You can customize the layout, styling, and formatting to fit your needs.

    Step 4 — Triggering PDF export

    Now, integrate the PDF export function into your existing Remix component(s) where you want to trigger the PDF export. You’ll use the app/routes/_index.tsx file as your root route:

    import { exportToPDF } from '../../src/utils/exportToPDF';

    const Index: React.FC = () => {

    const handleExport = () => {

    exportToPDF('Hello, this is my PDF content!'); // Replace with your content.

    };

    return (

    <div>

    <h1>Welcome to Remix PDF Export</h1>

    <button onClick={handleExport}>Export to PDF</button>

    </div>

    );

    };

    export default Index;

    Step 5 — Starting the Remix development server

    To start the Remix development server, run the following command:

    This will launch your Remix application locally, and you can access it in your web browser.

    Visit the root URL (e.g. http://localhost:3000/) to test your Remix application. When you click the Export to PDF button, the PDF will be generated and downloaded to your device.

    result

    Step 6 — Adding styling and customization

    You can further enhance your PDF by styling it and adding images, headers, and footers. Be sure to refer to the jsPDF documentation(opens in a new tab) for more advanced customization options.

    Using Nutrient for PDF generation

    Nutrient offers two robust products that cater to your PDF generation requirements. These products provide versatile solutions for creating and customizing PDF documents from HTML and CSS templates, making them valuable assets for developers looking to enhance their PDF generation capabilities.

    Nutrient PDF Generation API

    Nutrient offers a PDF Generator API that enables developers to generate PDF documents from HTML and CSS templates. This API is a powerful and versatile solution for creating high-quality PDFs tailored to your specific needs. Key features and advantages of the Nutrient PDF Generation API include:

    • Security — Nutrient is SOC 2 compliant, ensuring the security of your document data. It doesn’t store any document data, and all API endpoints are served through encrypted connections.
    • Easy integration — The API provides well-documented endpoints and code samples that simplify integration into your existing workflows, allowing you to get up and running quickly.
    • Versatility — With access to more than 30 tools, you can perform multiple actions on a single document. These actions include conversion, OCR, rotation, watermarking, and more, all in one API call.
    • Transparent pricing — You only pay for the number of documents you process, without the need to consider factors like file size or different API actions being called.

    To get started with the Nutrient PDF Generation API, sign up for a free trial(opens in a new tab) that provides you with 50 credits at no cost. The API also includes detailed documentation and customization options for structuring your HTML files effectively.

    Document Engine PDF Generation

    Document Engine offers a PDF Generation component that allows you to design PDFs from scratch. It leverages HTML and CSS to create highly flexible and context-customized PDFs for your users. This component is designed for advanced users who need precise control over a PDF’s layout and content. Key features include:

    • Design flexibility — Create PDFs from scratch using HTML and CSS to achieve custom layouts.
    • Layout control — You have granular control over various aspects of a document’s layout and how HTML files and assets are passed.
    • Advanced topics — Document Engine provides guides on advanced topics like form support, template design, creating PDFs from images, and more.

    Whether you choose to use the Nutrient PDF Generation API or Document Engine PDF Server, you’ll have access to a powerful set of tools for generating PDF documents tailored to your unique requirements.

    Launch Demo

    Conclusion

    Exporting content to PDF in React can enhance user experiences. We’ve explored two approaches: jsPDF for simplicity, and Nutrient for advanced capabilities. Choose the best fit for your project — whether it’s basic PDF generation with jsPDF or the advanced features of Nutrient — and empower your users with the ability to export content to PDF.

    To get started with Nutrient, you can either:

    • Start your free trial to test out the library and see how it works in your application.
    • Launch our demo to see the viewer in action.

    Explore related topics

    Try for free Ready to get started?

    Related SDK articles

    Explore more