ComPDFKit API in Python
ComPDFKit API provides a variety of Python API tools that allow you to create an efficient document processing workflow in a single API call. Try our various APIs for free — no credit card required.
Requirements
Programming Environment: Python 3.8 and higher.
Installation
You can install the library via pip. Run the following command:
pip install compdfkit-api-python
Create API Client
You can use your publicKey and secretKey to complete the authentication. You need to sign in your ComPDFKit API account to get your publicKey and secretKey at the dashboard. If you are new to ComPDFKit, click here to sign up for a free trial.
-
Project public Key : You can find the public key in Management Panel.
-
Project secret Key : You can find the secret Key in Management Panel.
# Create a client
client = CPDFClient(public_key, secret_key)
Create Task
A task ID is automatically generated for you based on the type of PDF tool you choose. You can provide the callback notification URL. After the task processing is completed, we will notify you of the task result through the callback interface. You can perform other operations according to the request result, such as checking the status of the task, uploading files, starting the task, or downloading the result file.
# Create a client
client = CPDFClient(public_key, secret_key)
# Create a task
# Create an example of a PDF TO WORD task
create_task_result = client.create_task(CPDFConversionEnum.PDF_TO_WORD)
# Get a task id
task_id = create_task_result.task_id
Upload Files
Upload the original file and bind the file to the task ID. The field parameter is used to pass the JSON string to set the processing parameters for the file. Each file will generate automatically a unique filekey. Please note that a maximum of five files can be uploaded for a task ID and no files can be uploaded for that task after it has started.
# Create a client
client = CPDFClient(public_key, secret_key)
# Create a task
# Create an example of a PDF TO WORD task
create_task_result = client.create_task(CPDFConversionEnum.PDF_TO_WORD)
# Get a task id
task_id = create_task_result.task_id
# Upload files
client.upload_file(convert_file, task_id)
Execute the task
After the file upload is completed, call this interface with the task ID to process the files.
# Create a client
client = CPDFClient(public_key, secret_key)
# Create a task
# Create an example of a PDF TO WORD task
create_task_result = client.create_task(CPDFConversionEnum.PDF_TO_WORD)
# Get a task id
task_id = create_task_result.task_id
# Upload files
client.upload_file(convert_file, task_id)
# execute Task
client.execute_task(task_id)
Get Task Info
Request task status and file-related meta data based on the task ID.
# Create a client
client = CPDFClient(public_key, secret_key)
# Create a task
# Create an example of a PDF TO WORD task
create_task_result = client.create_task(CPDFConversionEnum.PDF_TO_WORD)
# Get a task id
task_id = create_task_result.task_id
# Upload files
client.upload_file(convert_file, task_id)
# execute Task
client.execute_task(task_id)
# Query TaskInfo
task_info = client.get_task_info(task_id)
Resources
Metadata
Release files for compdfkit-api-python 1.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| compdfkit-api-python-1.3.3.tar.gz | 18.5 kB | Without provenance | Details for compdfkit-api-python-1.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| compdfkit_api_python-1.3.3-py3-none-any.whl | Python 3 | none | any | Details for compdfkit_api_python-1.3.3-py3-none-any.whl |
Total release size: 38.2 kB
Release files / compdfkit-api-python-1.3.3.tar.gz
| Download URL | compdfkit-api-python-1.3.3.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0235d59f61e6b39a8faefb8abc0a961e3cacb8a6e0e797954bd05faa0d868d79
|
|
BLAKE2b-256 checksum How to use checksums |
322b093cb30e1391db5727ab7fbee30455887baa5cd8a6456ad2dd4b798b299a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.6
|
Release files / compdfkit_api_python-1.3.3-py3-none-any.whl
| Download URL | compdfkit_api_python-1.3.3-py3-none-any.whl |
|---|---|
| Size | 19.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3aac9d07b70beabc79ed298e2f79bcbe225c2b17ddd7ac114317da839a3a3308
|
|
BLAKE2b-256 checksum How to use checksums |
1e98bafe4b18907a3044baff297e44c082af6fab4b7f391c9fe42b75006b36c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.6
|
Security for compdfkit-api-python 1.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.