The Python SDK provides a client for integrating PDFGate API endpoints into your Python applications.
Source code: github.com/pdfgate/pdfgate-sdk-python
Package: pypi.org/project/pdfgate
Install the package with pip, then initialize the client with your API key.
1pip install pdfgateThe example below generates a PDF from a URL and prints the resulting document id.
1import os23from pdfgate import PDFGate, GeneratePDFParams456client = PDFGate(api_key=os.getenv("PDFGATE_API_KEY"))7params = GeneratePDFParams(url="https://example.com")8document = client.generate_pdf(params)910print(document["id"])The SDK exposes both sync and async variants. Async methods use the same interface and add an _async suffix.
1document_response = client.get_document(GetDocumentParams(document_id=document_id))23# VS45document_response = await client.get_document_async(GetDocumentParams(document_id=document_id))Use get_file to retrieve the file bytes and save them locally.
1file_content = client.get_file(GetFileParams(document_id=document_id))23with open("output.pdf", "wb") as f:4 f.write(file_content)| Method | Purpose |
|---|---|
generate_pdf | Generate a PDF from HTML or a public URL. |
get_document | Retrieve document metadata and file information. |
get_file | Download the raw PDF bytes for a stored document. |
upload_file | Upload a PDF file for later transformations. |
flatten_pdf | Flatten form fields into a non-editable PDF. |
compress_pdf | Compress a PDF and return the resulting document record. |
watermark_pdf | Apply image or text watermarks to a document. |
protect_pdf | Encrypt a PDF and apply access restrictions. |
extract_pdf_form_data | Read field values from a fillable PDF. |
Use the SDK together with the main API documentation for request parameters, endpoint behavior, and workflow guides such as webhooks and PDF form fields.