Advanced HTML to PDF - Package Developed By 1 More Code.
Easily convert HTML content into high-quality PDF documents in Flutter.
Advanced HTML to PDF is a simple yet powerful Flutter package that lets you convert HTML content into professional PDF files.
It works across Android, iOS, Linux, macOS, Windows and supports custom filenames, directories, and paper formats.
- Convert raw HTML into a PDF document
- Fully customizable with headers, footers, and styles
- Works with Flutter mobile, web, and desktop
- Supports saving in documents or temporary directory
- Access file path and raw bytes for sharing
import 'package:advanced_html_to_pdf/advanced_html_to_pdf.dart';Example 1. Create HTML to PDF to get Path:
var htmlContent = """
<html>
<body>
<h1>Hello, PDF!</h1>
<p>This PDF was generated from HTML.</p>
</body>
</html>
""";final path = await AdvancedHtmlToPdf.fromHtmlToFile(
htmlContent,
options: HtmlToPdfOptions(filename: "demo"),
);Example 2. Create HTML to PDF to get File Object:
var htmlContent = """
<html>
<body>
<h1>Hello, PDF!</h1>
<p>This PDF was generated from HTML.</p>
</body>
</html>
""";final path = await AdvancedHtmlToPdf.fromHtmlToFileObject(
htmlContent,
options: HtmlToPdfOptions(filename: "demo"),
);Example 3. Create HTML to PDF to get fromHtmlToBytes:
var htmlContent = """
<html>
<body>
<h1>Hello, PDF!</h1>
<p>This PDF was generated from HTML.</p>
</body>
</html>
""";final path = await AdvancedHtmlToPdf.fromHtmlToBytes(
htmlContent,
options: HtmlToPdfOptions(filename: "demo"),
);Here is the output: View Demo PDF
Add this to your pubspec.yaml:
dependencies:
advanced_html_to_pdf: ^0.0.1Please file an issue to send feedback or report a bug,
If you want to ask a question or suggest an idea then you can open an discussion.
Thank you!
Every pull request is most welcome 🤝.
If this package saves your time. You can now buy me a coffee!
Scan bellow QR code or click and don't forget to leave a message there:
