Official Python client library for Nutrient Document Web Services API - PDF processing, OCR, watermarking, and document manipulation with automatic Office format conversion
Repo PSPDFKit/nutrient-dws-client-python, read from GitHub 20 h ago. PSPDFKit has not joined Take My Repo.
sign() method to local files only (API limitation)sign() only accepts local files (paths, bytes, file objects) - no URLsFileInputWithUrl - URLs passed to serverrotate(), split(), deletePages() now support negative indices (-1 = last page)sign() accept URLs that are passed securely to the serverprocess_remote_file_input() from public API (security risk)get_pdf_page_count() from public API (client-side PDF parsing)is_valid_pdf() from public API (internal use only)This release adds significant new functionality with 13 new Direct API methods and numerous stability improvements.
create_redactions_preset() - Create redactions using predefined patterns (SSN, email, phone, etc.)create_redactions_regex() - Create redactions using custom regex patternscreate_redactions_text() - Create redactions for specific text stringsoptimize_pdf() - Optimize PDF file size and performancepassword_protect_pdf() - Add password protection to PDFsset_pdf_metadata() - Update PDF metadata (title, author)split_pdf() - Split PDFs into multiple files based on page rangesduplicate_pdf_pages() - Duplicate specific pages within a PDFdelete_pdf_pages() - Remove specific pages from a PDFadd_page() - Insert blank pages at specific positionsapply_instant_json() - Apply PSPDFKit Instant JSON annotationsapply_xfdf() - Apply XFDF annotations to PDFsset_page_label() - Set custom page labels (Roman numerals, letters, etc.)watermark_pdf() method - now accepts PNG/JPEG images as watermarkspip install nutrient-dws==1.0.2
See the README for usage examples of the new features.
Full Changelog: v1.0.1...v1.0.2
Release Date: June 20, 2024
NutrientTimeoutError instead of TimeoutError in import examples and exception handlingImportError: cannot import name 'TimeoutError'Full Changelog: v1.0.0...v1.0.1
This patch release fixes a critical documentation bug that would prevent users from successfully importing the library when following README examples. It also adds significant testing infrastructure and stability improvements based on 29 commits of fixes and enhancements.
Upgrade recommended for all users to avoid import errors.
EOF < /dev/null
Release Date: June 17, 2024
We are excited to announce the first release of the official Python client library for Nutrient Document Web Services (DWS) API! This library provides a comprehensive, Pythonic interface for document processing operations including PDF manipulation, OCR, watermarking, and more.
The library offers two complementary ways to interact with the Nutrient API:
A major discovery during development: the Nutrient API automatically converts Office documents (DOCX, XLSX, PPTX) to PDF when processing them. This means you can:
pip install nutrient-dws
from nutrient_dws import NutrientClient # Initialize client client = NutrientClient(api_key="your-api-key") # Direct API - Single operation client.rotate_pages("document.pdf", output_path="rotated.pdf", degrees=90) # Convert Office document to PDF (automatic!) client.convert_to_pdf("report.docx", output_path="report.pdf") # Builder API - Complex workflow client.build(input_file="scan.pdf") \ .add_step("ocr-pdf", {"language": "english"}) \ .add_step("watermark-pdf", {"text": "CONFIDENTIAL"}) \ .add_step("flatten-annotations") \ .execute(output_path="processed.pdf") # Merge PDFs and Office documents together client.merge_pdfs([ "chapter1.pdf", "chapter2.docx", "appendix.xlsx" ], output_path="complete_document.pdf")
The library provides specific exceptions for different error scenarios:
from nutrient_dws import NutrientClient, AuthenticationError, ValidationError try: client = NutrientClient(api_key="your-api-key") result = client.ocr_pdf("scan.pdf") except AuthenticationError: print("Invalid API key") except ValidationError as e: print(f"Invalid parameters: {e.errors}")
We welcome contributions! Please see our Contributing Guidelines for details.
This project is licensed under the MIT License.
Special thanks to the Nutrient team for their excellent API and documentation.
Note: This is the initial release. We're actively working on additional features including more language support for OCR, additional file format support, and performance optimizations. Stay tuned!
For questions or support, please open an issue.