zaynpdf_flutter_pdf 1.1.6 copy "zaynpdf_flutter_pdf: ^1.1.6" to clipboard
zaynpdf_flutter_pdf: ^1.1.6 copied to clipboard

discontinued

Official ZaynPDF Flutter SDK for high-performance PDF manipulation. Edit live text, convert 30+ file formats, compress, merge, split, OCR, watermark & protect PDFs with ease.

ZaynPDF Flutter SDK (zaynpdf_flutter_pdf) #

Pub Version License: MIT Flutter ZaynPDF Engine

The Official All-in-One PDF SDK & Built-in Interactive Viewer for Flutter.

Edit live text directly inside PDFs, convert 30+ file formats (Word, Excel, PowerPoint, Images, HTML), encrypt with passwords, compress size, merge, split, OCR, watermark, and view PDFs with interactive touch-text selection handles.

Important

🔑 Get Your API Key #

Generate your API Key directly from the official ZaynPDF Dashboard.


✨ Key Features #

  • ✍️ Live Visual Text Replacement: Search & edit text in PDFs (single words, multi-word phrases, or full lines) with automatic PDF stream space-expansion matching.
  • 📄 Universal 30+ Format Converter:
    • File to PDF: Convert Word (.docx), Excel (.xlsx), PowerPoint (.pptx), Images (.jpg, .png, .webp, .heic), eBooks (.epub), HTML, Text (.txt), and live Website URLs to PDF.
    • PDF to File: Convert PDF to Word, Excel, PowerPoint, PNG/JPG Images (ZIP), Text, CSV, Markdown, HTML, and XML.
  • 🔒 Security & Encryption: Password-protect PDFs, remove passwords, add text watermarks, censor/redact sensitive text, draw signatures, and flatten form fields.
  • Page Operations: Merge multiple PDFs, split pages, extract specific page ranges, rotate pages (90°, 180°, 270°), crop margins, and auto-remove blank pages.
  • ⚙️ Optimization & OCR: Compress PDF file size (Ghostscript quality tuning), run OCR on scanned PDFs to make text searchable, and repair corrupted PDF files.
  • 📖 Built-in ZaynPdfViewer Widget: Includes an interactive PDF viewer widget with long-press touch-text selection handles, pinch-to-zoom, and scrolling out-of-the-box!

🚀 Installation #

Add zaynpdf_flutter_pdf to your pubspec.yaml file:

dependencies:
  zaynpdf_flutter_pdf: ^1.1.6

Then run:

flutter pub get

⚡ Quick Start #

1. Initialize ZaynPDF SDK in main.dart #

Get your API Key from ZaynPDF Dashboard and initialize the SDK before calling runApp():

import 'package:flutter/material.dart';
import 'package:zaynpdf_flutter_pdf/zaynpdf_flutter_pdf.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize ZaynPDF Engine with your API Key
  ZaynPDF.initialize(
    apiKey: 'YOUR_ZAYNPDF_API_KEY',
    defaultTimeout: const Duration(seconds: 90),
  );

  runApp(const MyApp());
}

💡 Code Examples #

1. Edit Live Text in PDF #

Search and replace text in any PDF document (supports single words, multi-word phrases, and full lines):

File editedPdf = await ZaynPDF.instance.editText(
  pdfFile: originalPdfFile,
  edits: [
    PdfTextEdit(find: 'UNPAID', replace: 'PAID IN FULL'),
    PdfTextEdit(find: 'VISIT TIMINGS', replace: 'Shah Baloch'),
  ],
  onProgress: (sentBytes, totalBytes) {
    print('Progress: ${(sentBytes / totalBytes * 100).toStringAsFixed(0)}%');
  },
);

2. Convert Word, Excel, or Images to PDF #

Convert any Office document, Image (.jpg, .png), HTML file, or Web URL to a PDF preview:

// Convert Word / Image / HTML to PDF
File pdfFile = await ZaynPDF.instance.convertToPdf(
  sourceFile: File('/path/to/invoice.docx'),
);

// Convert live Website URL to PDF
File webPdf = await ZaynPDF.instance.urlToPdf(
  url: 'https://zaynpdf.com',
);

3. Password Protect & Encrypt PDF #

Lock a PDF file with user and owner passwords:

File protectedPdf = await ZaynPDF.instance.protectPdf(
  pdfFile: myPdfFile,
  userPassword: 'MySecurePassword123',
);

4. Compress PDF File Size #

Reduce file size while preserving document quality:

File compressedPdf = await ZaynPDF.instance.compressPdf(
  pdfFile: heavyPdfFile,
);

5. Render Interactive PDF with Built-in ZaynPdfViewer #

Display local PDF files or remote network PDF streams with built-in text touch selection handles:

import 'package:flutter/material.dart';
import 'package:zaynpdf_flutter_pdf/zaynpdf_flutter_pdf.dart';

class PdfViewerScreen extends StatelessWidget {
  final File pdfFile;
  const PdfViewerScreen({super.key, required this.pdfFile});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('ZaynPDF Viewer')),
      body: ZaynPdfViewer.file(
        pdfFile,
        enableTextSelection: true,
        onTextSelectionChanged: (details) {
          if (details.selectedText != null) {
            print('Selected text: ${details.selectedText}');
          }
        },
      ),
    );
  }
}

📚 API Reference Table (42 Methods) #

Category Method Description
Editing editText() Search & replace text (single/multi-word/full lines)
Conversion convertToPdf() Convert Word, Excel, PPT, Images, HTML, Text to PDF
urlToPdf() Convert live Web URL to PDF
htmlToPdf() Convert raw HTML file/string to PDF
markdownToPdf() Convert Markdown file to PDF
pdfToWord() Convert PDF to editable Word (.docx)
pdfToExcel() Convert PDF tables to Excel (.xlsx)
pdfToPowerPoint() Convert PDF to PowerPoint (.pptx)
pdfToImages() Export PDF pages as PNG/JPG images (ZIP)
pdfToText() Extract clean plain text from PDF
pdfToCsv() Extract PDF tables to CSV spreadsheet
pdfToXml() Convert PDF to XML document
Security protectPdf() Password encrypt & lock PDF
unlockPdf() Remove password from protected PDF
watermarkPdf() Add custom text watermark with opacity & rotation
redactPdf() Auto-redact / censor sensitive text
signPdf() Apply digital signature or image stamp
flattenPdf() Flatten interactive form fields into static content
Page Ops mergePdfs() Combine multiple PDFs into a single file
splitPdf() Split PDF into individual pages
extractPages() Extract specific page ranges (e.g. 1-3,5)
rotatePdf() Rotate pages (90°, 180°, 270°)
cropPdf() Crop page margins
organizePdf() Reorder or delete specific pages
addPageNumbers() Add page numbers (Page X of Y)
removeBlankPages() Auto-detect and remove blank pages
removeImages() Extract or strip images from PDF
Optimization compressPdf() Reduce file size via Ghostscript compression
ocrPdf() Optical Character Recognition for scanned PDFs
repairPdf() Repair corrupt or broken PDF files
pdfToPdfA() Convert to archiving standard PDF/A format
invertColorsPdf() Invert colors for dark mode reading
Utilities & UI ZaynPDF.initialize() Global API Key & timeout configuration
ZaynPDF.clearCache() Clean up SDK temporary cache files from disk
ZaynPdfViewer Built-in interactive PDF viewer widget

🎯 Demo #

Check out the example/ folder in the GitHub Repository for a fully working demonstration of the package.


📄 License #

This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2026 BalochCodes.


👤 Author & Publisher Metadata #

0
likes
160
points
93
downloads

Documentation

API reference

Publisher

verified publisherbalochcodes.com

Weekly Downloads

Official ZaynPDF Flutter SDK for high-performance PDF manipulation. Edit live text, convert 30+ file formats, compress, merge, split, OCR, watermark & protect PDFs with ease.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, http, path_provider, syncfusion_flutter_pdfviewer

More

Packages that depend on zaynpdf_flutter_pdf