Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion samples/python/api/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from pydantic import BaseModel, Field
from pydantic_settings import BaseSettings, SettingsConfigDict


TOKEN_EXPIRY_BUFFER_SECONDS = 60


Expand Down
10 changes: 8 additions & 2 deletions samples/python/api/platform_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def _request(
data = {"method": method, "params": json.dumps(params or {})}

response = self._client.post(
f"{self._settings.platform_base_url}/{endpoint}", headers=headers, files=files, data=data
f"{self._settings.platform_base_url}/{endpoint}",
headers=headers,
files=files,
data=data,
)

response.raise_for_status()
Expand All @@ -62,7 +65,10 @@ def _request_bytes(
data = {"method": method, "params": json.dumps(params or {})}

response = self._client.post(
f"{self._settings.platform_base_url}/{endpoint}", headers=headers, files=files, data=data
f"{self._settings.platform_base_url}/{endpoint}",
headers=headers,
files=files,
data=data,
)

response.raise_for_status()
Expand Down
29 changes: 16 additions & 13 deletions samples/python/batch_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
📁 BATCH DOCUMENT CONVERSION
=============================

The script exemplifies a typical workflow for document format standardization.
As a IT administrator, it's essential to convert
large collections of documents into standardized formats for archival, compliance,
or system integration purposes. Manually converting individual files through desktop
applications is time-consuming and impractical for large document sets, often leading
to inconsistent results and wasted effort.

This workflow automates bulk document conversion. The script processes files
individually - for every document matching the specified pattern in the input folder,
it converts the file to the target format (PDF, DOCX, XLSX, PNG, JPG, etc.) using
high-fidelity conversion algorithms. Each converted file is saved to the output
folder with the same base name but the new format extension, resulting in a
complete batch of standardized documents.
This script shows a standard workflow for document format standardization.

As an IT administrator, you must convert many documents to standard
formats for archiving, compliance, or system integration. Manual conversion
with desktop applications takes a long time and is not practical for large
document sets. It can also cause inconsistent results and wasted effort.

This workflow automates bulk document conversion. The script scans the input
folder for files that match a specified pattern and processes each file one
by one. For each document, the script converts the file to the target format,
such as PDF, DOCX, XLSX, PNG, or JPG, using high-quality conversion methods.

Each converted file is saved in the output folder with the same base name and a new
format extension. The result is a complete set of standardized documents that are
ready for use.

BATCH CONVERSION FEATURES:
✓ Multiple format support (PDF, DOCX, XLSX, PNG, JPG, etc.)
Expand All @@ -38,6 +40,7 @@
from api.platform_api import PlatformAPIClient
from helper_functions.document_helpers import validate_and_setup


class OutputFormat(str, Enum):
"""Supported output formats for document conversion."""

Expand Down
33 changes: 20 additions & 13 deletions samples/python/bulk_password_protect.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@
🔐 BULK PASSWORD PROTECTION
============================

The script exemplifies a typical workflow for securing confidential documents.
As a security professional, it's essential to protect sensitive
documents with passwords before distributing them to authorized personnel, storing
them in shared drives, or archiving them for compliance purposes. Manually setting
passwords on individual files is tedious and inconsistent, leading to weak passwords
or missed files that remain unprotected.

This workflow automates secure document protection. The script processes each PDF
file individually - for every document in the input folder, it applies robust
password encryption using a consistent password across all files. Each protected
file is saved to the output folder with the same filename, ensuring that the entire
batch of documents maintains uniform security standards. The result is a complete
set of password-protected PDFs ready for secure distribution or storage.
This script shows a standard workflow to protect confidential documents.

Security staff must protect sensitive documents with passwords before they
share them with authorized users, save them in shared drives, or store them
for compliance. Manually adding passwords to individual files takes a lot of
time and can cause errors. This can result in weak passwords or files that are
not protected. This workflow automates document protection.

The script processes one PDF file at a time. For each PDF file in the input folder, the script:

Applies password encryption

Uses the same password for all files

Saves the protected file to the output folder with the same file
name

This process ensures that all documents follow the same security standard.
The result is a set of password-protected PDF files ready for secure
sharing or storage.

DOCUMENT SECURITY STANDARDS:
✓ Password encryption (AES-256)
Expand Down
28 changes: 17 additions & 11 deletions samples/python/convert_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
🔄 SINGLE DOCUMENT CONVERSION
==============================

The script exemplifies a typical workflow for quick document format conversion.
As a business professional, you often need to convert individual
documents between formats for sharing, presentations, or compatibility requirements.
Whether converting a Word document to PDF for distribution, an Excel spreadsheet to
CSV for data processing, or a presentation to images for web display, manual
conversion through multiple applications is inefficient.

This workflow provides instant document conversion. The script takes a single input
file and converts it to the specified output format using professional-grade
conversion algorithms. The result is a high-quality converted file that preserves
formatting, structure, and content fidelity, ready for immediate use.
This script demonstrates a simple and efficient way to convert documents between formats.

In daily work, you may need to convert individual files for sharing,
presenting, or ensuring compatibility with different systems. For example,
you might convert a Word document to a PDF for easy distribution, an Excel
spreadsheet to a CSV file for data processing, or a presentation into images
for use on a website. Doing this manually across multiple applications can be
time-consuming and inconvenient.

This workflow simplifies the process by providing instant document
conversion. You supply a single input file and choose the desired output
format. The script handles the conversion automatically using high-quality
conversion methods.

The resulting file maintains the original layout, structure, and content
accuracy, so it is ready to use right away.

CONVERSION FEATURES:
✓ Multiple format support (PDF, DOCX, XLSX, PNG, etc.)
Expand All @@ -36,6 +41,7 @@

from api.platform_api import PlatformAPIClient


class OutputFormat(str, Enum):
"""Supported output formats for document conversion."""

Expand Down
45 changes: 27 additions & 18 deletions samples/python/employee_policy_onboarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,33 @@
📝 EMPLOYEE POLICY ONBOARDING
==============================

This script exemplifies a typical HR onboarding workflow for new employees.
As an HR professional, it's necessary to ensure all new hires review and sign
required company policies before their start date. Manual distribution and
tracking of signatures is time-consuming and error-prone, especially when
onboarding multiple employees simultaneously.

This workflow automates policy distribution and signature collection. The script
processes each new employee individually - for every person in the CSV file, it
creates a signature envelope containing all company policy documents, sends it
via email with signature fields pre-configured, monitors the signing status, and
automatically downloads the signed documents once completed. Each employee's
signed policies are organized in their own folder, creating an audit-ready
archive of onboarding documentation.


NOTE: To run this script and see the complete workflow, you must provide a CSV file
with valid employee names and email addresses. The script will send actual signature
requests to these email addresses and wait for them to be signed.
HR staff must make sure that all new employees review and sign required
company policies before their start date. Manual distribution and manual
tracking of signed documents takes a lot of time and can cause errors. This
is especially true when you onboard many employees at the same time.

This workflow automates the distribution of policies and the collection of signatures.

The script processes one employee at a time. For each employee listed in the CSV file, the script:

Creates a signature envelope that contains all required company policy documents

Sends the envelope by email with signature fields already set

Tracks the signature status

Downloads the signed documents when the signing process is complete

The script saves each employee's signed documents in a separate folder.
This creates an organized and audit-ready record of onboarding
documents.


NOTE: To run this script and view the full workflow, you must provide a
CSV file with valid employee names and email addresses. The script sends
real signature requests to these email addresses and waits for the
employees to sign the documents.


EMPLOYEE CSV FORMAT:
name,email
Expand Down
29 changes: 17 additions & 12 deletions samples/python/extract_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@
📊 DOCUMENT DATA EXTRACTION
============================

The script exemplifies a typical workflow for intelligent document data extraction.
As a data analyst, you need to extract structured
data from PDF documents - whether form fields from applications, surveys, and
questionnaires, or table data from reports, invoices, and financial statements.
Manual data entry is error-prone and time-consuming, especially when processing
hundreds of documents for analysis or database import.

This workflow automates data extraction using AI-powered document understanding.
The script analyzes PDF documents and intelligently identifies and extracts either
form fields (with field names and values) or table structures (with rows, columns,
and cell contents). The extracted data is saved as structured JSON, ready for
immediate integration with databases, spreadsheets, or analytics pipelines.
This script shows how to automatically extract useful data from PDF documents.

If you work with PDFs, you often need to pull structured information from
them. This might include form fields from applications, surveys, or
questionnaires, as well as table data from reports, invoices, or financial
statements. Entering this information by hand can be slow and can lead to
mistakes, especially when you are processing a large number of documents.

This workflow makes the process faster and easier by automating data
extraction. The script analyzes PDF files and uses intelligent document
analysis to find and extract the information you need. It can capture form
fields with their names and values, or detect tables and extract their rows,
columns, and cell contents.

The extracted data is saved in a structured JSON format. This makes it
easy to load into databases, spreadsheets, or analytics tools so you can
start working with the data right away.

DATA EXTRACTION FEATURES:
✓ AI-powered form field extraction
Expand Down
2 changes: 0 additions & 2 deletions samples/python/helper_functions/sign_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from pathlib import Path
from typing import TYPE_CHECKING, Any

import httpx

if TYPE_CHECKING:
from api.sign_api import SignAPIClient

Expand Down
31 changes: 19 additions & 12 deletions samples/python/prepare_pdf_for_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@
🔒 PREPARE PDF FOR DISTRIBUTION
================================

The script exemplifies a typical workflow of marketing brochure distribution.
As a marketing professional, it's necessary to share company brochures externally
while ensuring they comply with corporate distribution standards. Word document
properties can expose internal information such as author names, template paths,
revision history, and company file structures that should remain confidential.

This workflow automates compliant document preparation. The script processes each
file individually - for every brochure in the input folder, it converts the Word
document into PDF format, then compresses the file to reduce size and optimize
transmission, and finally removes all metadata properties to ensure privacy and
confidentiality. Each processed file is saved to the output folder, resulting in
distribution-ready brochures.
This script shows a standard workflow for distributing marketing brochures.
As a marketing professional, it's necessary to share company brochures
externally while ensuring they comply with corporate distribution standards.
Word document properties can expose internal information such as author names,
template paths, revision history, and company file structures that should
remain confidential.

This workflow prepares documents for compliant distribution. The script
processes each file separately. For each brochure in the input folder,
the script performs these steps:

1. Convert the Word document to PDF format.

2. Compress the PDF file to reduce file size and improve transmission.

3. Remove all metadata to protect privacy and confidentiality.

The script saves each processed file to the output folder. The result is
a set of brochures that are ready for external distribution.

COMPANY DISTRIBUTION STANDARDS:
✓ PDF format (prevents editing)
Expand Down
30 changes: 17 additions & 13 deletions samples/python/redact_by_keyword.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@
🔍 KEYWORD-BASED REDACTION
===========================

The script exemplifies a typical workflow for targeted content redaction.
As a compliance officer, you need to redact specific
sensitive terms from documents before external sharing or public disclosure.
Whether removing client names, project codenames, financial figures, or
proprietary terminology, manually searching through pages and applying redactions
is tedious and risks missing instances, potentially exposing confidential information.

This workflow automates keyword-based redaction. The script searches the entire
PDF document for all specified keywords and phrases, identifies their exact
locations across all pages, then automatically applies permanent redactions to
remove them. Multiple keywords can be processed in a single pass, ensuring
comprehensive coverage. The result is a thoroughly redacted document ready for
safe distribution.
This script shows a standard workflow for targeted content redaction.

As a compliance officer, you must remove sensitive information from
documents before you share them outside the organization or release them to
the public. This information can include client names, project code names,
financial values, or proprietary terms. Finding and removing this content
by hand can be slow and difficult. You can also miss some instances, which
can expose confidential information.

This workflow automates keyword-based redaction. The script searches the
full PDF document for all specified keywords and phrases. It finds each
instance on every page. The script then applies permanent redactions to
remove the content.

You can process multiple keywords in one run that ensures full and
consistent coverage. The result is a clean, redacted document that is safe
to share.

KEYWORD REDACTION FEATURES:
✓ Multi-keyword search (process multiple terms)
Expand Down