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

推荐订阅源

D
Docker
爱范儿
爱范儿
人人都是产品经理
人人都是产品经理
博客园 - 司徒正美
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
量子位
罗磊的独立博客
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
小众软件
小众软件
C
Cybersecurity and Infrastructure Security Agency CISA
Cyberwarzone
Cyberwarzone
大猫的无限游戏
大猫的无限游戏
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
Simon Willison's Weblog
Simon Willison's Weblog
The Cloudflare Blog
博客园 - 三生石上(FineUI控件)
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园_首页
博客园 - 叶小钗
V
Vulnerabilities – Threatpost
T
The Exploit Database - CXSecurity.com
T
Tailwind CSS Blog
IT之家
IT之家
博客园 - 聂微东
Spread Privacy
Spread Privacy
V2EX - 技术
V2EX - 技术
S
Security Affairs
宝玉的分享
宝玉的分享
V
V2EX
C
Cisco Blogs
博客园 - Franky
美团技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
月光博客
月光博客
S
Securelist
J
Java Code Geeks
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
WordPress大学
WordPress大学
W
WeLiveSecurity
T
Threatpost
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志

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 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 manual QA uses PR testing between releases
How to convert HTML to PDF (2026): 4 methods from browser print to SDK
Hulya Masharipov · 2026-03-05 · via Inside Nutrient

TL;DR

Four ways to convert HTML to PDF format:

  • Browser print — Press Control-P (Command-P on Mac) and select Save as PDF. This method is free and works offline.
  • Online converters — Upload an HTML file or paste a URL to get a PDF back. Best for quick one-off conversions.
  • JavaScript libraries — Libraries like html2pdf.js, jsPDF, and Puppeteer let you build PDF export directly into your applications.
  • Professional SDKs — Nutrient Document Engine provides full CSS support, automatic form conversion, and enterprise-scale performance.

Converting HTML to PDF format is one of the most common document tasks. A PDF gives you a portable, printable document that looks the same on any device. This is useful for archiving webpages, sharing reports offline, or generating invoices from web applications.

This guide covers four methods, from quick browser options to developer-focused solutions for automated workflows.

Method 1: Use your browser (print to PDF)

Your browser’s built-in print function converts any webpage or local HTML file to PDF.

Chrome

  1. Open the HTML file or webpage in Chrome
  2. Press Control-P (Windows) or Command-P (Mac)
  3. Change Destination to Save as PDF
  4. Adjust settings (margins, scale, and background graphics)
  5. Click Save and choose a location

Firefox

  1. Open the HTML file or webpage in Firefox
  2. Press Control-P (Windows) or Command-P (Mac)
  3. Select Microsoft Print to PDF or Save to PDF
  4. Adjust layout options as needed
  5. Click Save

Safari

  1. Open the HTML file or webpage in Safari
  2. Go to File > Export as PDF, or press Command-P
  3. Click the PDF dropdown in the bottom-left corner
  4. Select Save as PDF
  5. Choose a location and click Save

Edge

  1. Open the HTML file or webpage in Edge
  2. Press Control-P (Windows)
  3. Change Printer to Microsoft Print to PDF or Save as PDF
  4. Adjust settings and click Save

Tips for better output

  • Enable Background graphics to include colors and images
  • Set Margins to None or Minimum for more content per page
  • Use Scale to fit wide content on the page
  • Remove Headers and footers for cleaner output
ProsCons
Free, no software neededLimited control over output
Works offlineMay break complex layouts
Available in all browsersManual process for each page

Method 2: Free online HTML-to-PDF converters

Online converters handle quick conversions without installing software. Upload an HTML file or enter a URL, and the service returns a PDF.

ToolMaximum file sizeWatermarkBatch convert
pdfcrowd2 MBNo (free tier)No
sejda50 MBNoYes (3 files)
ilovepdf25 MBNoYes
html2pdf.com15 MBNoNo
cloudconvert1 GBNoYes

When to use online converters

Online converters make sense when you need a quick PDF and don’t want to install anything. They’re useful for one-off conversions of public webpages or simple HTML files where exact formatting isn’t critical.

Avoid them for anything automated or sensitive, or where you need consistent results across multiple conversions.

Limitations to consider

  • Privacy — Your HTML content is uploaded to third-party servers, which may not be suitable for confidential documents.
  • File size limits — Free tiers restrict upload sizes, typically ranging from 2 MB to 50 MB.
  • Internet required — These tools require an active internet connection and cannot work offline.
  • Inconsistent rendering — CSS support varies significantly between tools, so complex layouts may not convert accurately.

For sensitive documents, avoid online converters. Use browser print or local tools instead.

Method 3: JavaScript libraries (for developers)

Several JavaScript libraries can add PDF export to your applications. These run either client-side (in the browser) or server-side (on your backend).

Client-side: html2pdf.js

html2pdf.js combines html2canvas and jsPDF to convert HTML elements to PDF directly in the browser:

// Include via CDN.

// <script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.14.0/html2pdf.bundle.min.js"></script>

const element = document.getElementById('content');

html2pdf().from(element).save('document.pdf');

This works for simple documents but produces image-based PDFs with limited CSS support.

Client-side: jsPDF

jsPDF creates PDFs programmatically from JavaScript objects rather than HTML:

// Include via CDN.

// <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/4.2.1/jspdf.umd.min.js"></script>

const doc = new jsPDF();

doc.text('Hello World', 10, 10);

doc.save('document.pdf');

Best for structured documents like invoices where you control the exact layout.

Server-side: Puppeteer and Playwright

Puppeteer and Playwright control headless browsers to render pages with full CSS support:

const { chromium } = require('playwright');

(async () => {

const browser = await chromium.launch();

const page = await browser.newPage();

await page.setContent('<h1>Invoice</h1><p>Details here...</p>');

await page.pdf({ path: 'invoice.pdf', format: 'A4' });

await browser.close();

})();

These produce high-fidelity PDFs but require server infrastructure.

When to use JavaScript libraries

  • Building apps with PDF export features
  • Automated report generation
  • Custom PDF workflows in your codebase

For a detailed comparison of JavaScript libraries, refer to our blog post on how to convert HTML to PDF with JavaScript.

Method 4: Professional SDKs (for production apps)

Free tools and open source libraries work for prototypes and internal tools. But when HTML-to-PDF conversion becomes part of your product — such as generating customer invoices, compliance reports, or contracts — you need reliability, consistent output, and support.

Why use a professional SDK?

Open source libraries render CSS inconsistently, produce flat PDFs without fillable form fields, and crash on large documents. They also lack enterprise security features and dedicated support. Professional SDKs solve these problems for production applications.

Nutrient solutions

Nutrient offers several options for HTML-to-PDF conversion: Document Engine for server-side processing, native SDKs for mobile and desktop platforms, a cloud API for zero-infrastructure setups, and no-code integrations for automated workflows.

Document Engine

Document Engine is a server-side toolkit that powers document processing, rendering, and automation behind the scenes of web, mobile, and desktop apps. It handles more than just HTML-to-PDF conversion: You can use it for document viewing, generation, conversion, OCR, redaction, and real-time collaboration at scale.

Document Engine uses a Chromium-based rendering engine, so modern CSS (flexbox, grid, custom fonts, and print stylesheets) works out of the box. We recommend previewing your HTML in Chrome before conversion, though minor differences may occur. HTML form elements (input, select, and textarea tags) automatically become fillable PDF form fields.

You can run document workflows entirely on the backend, or pair Document Engine with a frontend SDK. The backend handles large files and high-volume document batches that would overwhelm browser-based solutions. Features like form filling, annotation, and signing work through frontend and backend syncing, so users interact with documents in the browser while the server handles processing.

Document Engine integrates with .NET, Node.js, Java, iOS, Android, React Native, and Flutter.

curl -X POST http://localhost:5000/api/build \

-H "Authorization: Token token=<API token>" \

-F page.html=@/path/to/page.html \

-F instructions='{ "parts": [{ "html": "page.html" }] }' \

-o result.pdf

Three deployment options:

OptionYou manageNutrient managesGood for
Self-hostedEverythingNothingFull control, air-gapped environments
Cloud APINothingEverythingQuick start, pay-per-document
ManagedNothingDedicated instance for youCompliance needs without ops work

Self-hosted means you run the Docker container on your own servers. You control the infrastructure, updates, and scaling. This option works for air-gapped environments or when regulations require data to stay on-premises.

Nutrient Processor API is the fastest way to get started. You send HTTP requests to Nutrient’s servers and receive PDFs back. No infrastructure to manage, and you pay based on credits consumed. The API supports multiple languages, including JavaScript, Python, Java, C#, and PHP:

const axios = require('axios')

const FormData = require('form-data')

const fs = require('fs')

const formData = new FormData()

formData.append('html', fs.createReadStream('index.html'));

(async () => {

try {

const response = await axios.post('https://api.nutrient.io/processor/generate_pdf', formData, {

headers: formData.getHeaders({

'Authorization': 'Bearer your_api_key_here'

}),

responseType: "stream"

})

response.data.pipe(fs.createWriteStream("result.pdf"))

} catch (e) {

const errorString = await streamToString(e.response.data)

console.log(errorString)

}

})()

function streamToString(stream) {

const chunks = []

return new Promise((resolve, reject) => {

stream.on("data", (chunk) => chunks.push(Buffer.from(chunk)))

stream.on("error", (err) => reject(err))

stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")))

})

}

Managed gives you a dedicated Document Engine instance that Nutrient operates on your behalf. You get the isolation of self-hosting without the operational overhead. This option fits organizations that need compliance guarantees but don’t want to manage infrastructure.

.NET SDK

The .NET SDK brings HTML-to-PDF conversion to .NET applications. It uses Chrome-based rendering for consistent output.

The SDK integrates with C# and other .NET languages. You pass an HTML string or file path to the conversion method, and it returns a PDF document. Since it runs locally, your HTML content never leaves your servers.

Android and iOS SDKs

Our Android SDK and iOS SDK generate PDFs directly on mobile devices. Android uses the system WebView for rendering, while iOS uses WebKit. Both produce PDFs without requiring a network connection or external server.

On-device conversion keeps sensitive data on the device instead of sending it to a server. You can convert HTML strings or local HTML files (including file and content URIs on Android).

React Native and Flutter SDKs

Our React Native SDK and Flutter SDK provide HTML-to-PDF conversion for cross-platform mobile development. Both SDKs use native implementations under the hood (WebView on Android, WebKit on iOS), so you write one codebase that works on both platforms.

In Flutter, the generatePdfFromHtmlString and generatePdfFromHtmlUri methods return a path to the generated PDF file. The React Native SDK offers similar PDF generation capabilities.

Beyond conversion, Nutrient’s mobile SDKs include viewing, annotation, form filling, and digital signature features.

Zapier and Power Automate

Zapier integration and Power Automate connectors bring HTML-to-PDF conversion to no-code workflows. You can trigger PDF generation from events in other apps without writing any code.

These integrations let you automate HTML-to-PDF generation as part of larger workflows — for example, generating documents from templates or form submissions. The PDF generation happens on Nutrient’s servers, and you receive the finished document in your workflow.

What you can build with Nutrient

Invoices — Generate branded invoices from HTML templates with dynamic data, watermarks, and automatic delivery to customers.

Compliance reports — Add digital signatures, encryption, and tamper-evident seals for SOC 2, HIPAA, or financial audits.

Contracts — Convert HTML contracts to PDF with fillable signature fields.

Customer exports — Let users download reports, statements, or receipts as PDFs from your web app.

Document pipelines — Chain HTML conversion with OCR, redaction, and merging in a single API call.

Start a free trial to test full CSS support, form conversion, and high-volume processing. No watermarks or credit card required.

HTML-to-PDF conversion methods compared

MethodBest forCostCSS supportForm fields
Browser printQuick one-off savesFreeBasicNo
Online toolsNon-sensitive documentsFreeLimitedNo
Open source librariesPrototypes, internal toolsFreeVariesNo
NutrientProduction apps, automated workflowsPaidFullYes

Common issues when converting HTML to PDF

IssueCauseSolution
Formatting breaksCSS not supportedUse browser print or SDK with full CSS
Images not appearingRelative pathsUse absolute URLs or Base64 encoding
CSS not renderingModern CSS unsupportedAvoid flexbox/grid with basic tools
Large file sizesUncompressed imagesOptimize images before conversion
Page breaks wrongNo CSS page rulesAdd page-break-before CSS rules

FAQ

Open the HTML file in any browser, press Control-P (Windows) or Command-P (Mac), select Save as PDF as the destination, and click Save. This works in Chrome, Firefox, Safari, and Edge. For better results, enable Background graphics in the print settings to preserve colors and images.

HTML and PDF are different file formats, so you cannot open an HTML file directly as a PDF. First, convert the HTML to PDF using one of these methods: browser print (Control-P), an online converter, or a PDF generation tool. Once converted, open the resulting PDF file in any PDF reader.

Yes. Use your browser’s print to PDF feature (Control-P or Command-P), or open source libraries like html2pdf.js for basic use cases. Nutrient’s Cloud API offers 50 free credits monthly for testing.

Use a Chromium-based tool. Browser print may break flexbox or grid layouts. Nutrient Document Engine and the Cloud API support modern CSS, including flexbox, grid, custom fonts, and print stylesheets.

For one-off conversions, use your browser’s print function. For production applications, Nutrient offers Chromium-based rendering, automatic form field conversion, and enterprise features. The Cloud API is SOC 2-compliant and requires no infrastructure.

Most converters produce flat PDFs. Nutrient automatically converts HTML form elements into interactive, fillable PDF form fields.

On iOS and Android, you can use the browser’s share or print function for basic conversions. For in-app PDF generation, Nutrient provides native SDKs for iOS, Android, React Native, and Flutter. These SDKs generate PDFs on-device without requiring a server connection.

Conclusion

For one-off conversions, your browser’s print function works. For production applications that need consistent output and automated workflows, Nutrient provides self-hosted, cloud, and SDK options with Chromium-based rendering and enterprise security.

Start your free trial to test HTML-to-PDF conversion with no watermarks.