Python Client Library
The DynamicPDF API provides a full‑featured client library for Python that simplifies integration with the REST endpoints.
The Python client library is the official SDK for integrating the DynamicPDF API into Python applications, scripts, and backend services. It provides clean, Pythonic classes and methods that make it easy to generate PDFs, convert HTML and images to PDF, merge multiple documents, extract text and metadata, and perform detailed PDF inspection without managing low-level HTTP requests or serialization manually.With this library, Python developers can use the complete feature set of the DynamicPDF API, including programmatic PDF creation, merging or splitting existing documents, filling and flattening forms, stamping text or images onto pages, retrieving XMP and document information, rasterizing pages into images, and applying encryption or other security settings. The DynamicPDF API offers a comprehensive collection of PDF focused endpoints that support creation, conversion, manipulation, analysis, and secure delivery of PDF content within Python applications, whether running in web frameworks, automation scripts, or serverless environments.
The DynamicPDF API offers clean, intuitive wrappers around the following REST endpoints:
dlex-layoutfor creating dynamic PDF reports from DLEX templates and JSON data,image-infofor extracting detailed metadata from images,pdffor creating and manipulating PDFs, merging documents, and converting HTML, Word, and Excel files to PDF,pdf-infofor retrieving document information and metadata from existing PDFs,pdf-security-infofor obtaining PDF encryption details and security settings,pdf-textfor extracting text content from PDF pages, andpdf-xmpfor reading embedded XMP metadata from PDF files.
Installation
pip install dynamicpdf-api
Usage Example
def excel_example(apikey):
pdf=Pdf()
pdf.api_key=apikey
pdf.add_excel(ExcelResource("sample.xlsx"))
response = pdf.process()
if response.is_successful:
with open("output.pdf", "wb") as output_file:
output_file.write(response.content)
else:
print(response.error_id)