Skip to main content

A SDK wrapper for Foxit's PDF Services and Document Generation APIs.

Project description

Foxit PDF Services SDK

This SDK lets developers more easily use the Foxit APIs, including PDF Services and Document Generation. You will need a free set of credentials in order to call the APIs.

Usage

Copy your credentials to the environment and then instantiate the SDK. Here's a sample:

import pdf_service_sdk
import os 

CLIENT_ID = os.getenv("CLIENT_ID")
CLIENT_SECRET = os.getenv("CLIENT_SECRET")

sdk = pdf_service_sdk.PDFServiceSDK( client_id=CLIENT_ID,
                                     client_secret=CLIENT_SECRET)

Generally speaking, moist methods handle upload and download for you, checking the task and so forth so you don't need it. For example:

sdk.word_to_pdf(input_path="../../inputfiles/input.docx",output_path="../../output/output_from_sdk.pdf")
print("Conversion completed successfully. Check the output file at ../../output/output_from_sdk.pdf")

# Handle it simpler
sdk.conversion(input_path="../../inputfiles/input.docx",output_path="../../output/output_from_sdk_v2.pdf")
print("Conversion (second version) completed successfully. Check the output file at ../../output/output_from_sdk_v2.pdf")

Methods Supported

  • conversion(input_path, output_path) - general conversion method
  • excel_to_pdf, html_to_pdf, image_to_pdf, pdf_to_excel, pdf_to_html, pdf_to_image, pdf_to_powerpoint, pdf_to_text, pdf_to_word, powerpoint_to_word, text_to_pdf, word_to_pdf - all take an input_path and output_path argument
  • url_to_pdf(url, output_path) - convert a URL to pdf
  • extract(input_path, output_path, type (one of TEXT, IMAGE, PAGE), page_range) - extracts either text, images (zip), or pages (new pdf)
  • download(doc_id, output_path) - given a document id and path, will stream the data down
  • upload(path) - upload a document and return a path
  • compress(input_path,output_path,compressionLevel) - compresses a PDF, default level is LOW
  • linearize(input_path,output_path) - linearizes a PDF
  • flatten(input_path,output_path) - flattens a PDF
  • combine(input_path[], output_path, config) - combines an array of file paths
  • split(input_path, output_path, page_count) - splits a PDF into page_count files, returns a zip
  • compare(input_path, second_path, config, output_path) - compares two PDFs. You can leave off output_path and get the JSON directly, but if you ask for a PDF result, ensure you pass it.
  • docgen(input_path, output_path, data) - Runs document generation on an input Word file and returns a dynamic PDF or Word file based on data
  • remove_password(input_path, output_path, password) - Removes the password from a protected PDF
  • protect_pdf(input_path, output_path, config) - modifies permissions for a PDF - see API ref for details on the config param
  • manipulate_pdf(input_path, output_path, operations) - performs multiple operations for a PDF - see API ref for details on the operations param

To Do:

  • Make output path optional and just return the doc id
  • Make checking a task public and a utility pollTask to handle repeating (this and the previous two methods would let devs chain calls)
  • Modify extract so you can leave off output_path when working with JSON

History

Date Change
8/5/2025 Added remove password, pdf_protect, pdf_manipulate
7/31/2025 Added docgen, support for passing in docgen credentials
7/30/2025 Added split and compare
7/23/2025 Just updated the doc to reflect combine being added.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdfservices_sdk_foxit-1.0.0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdfservices_sdk_foxit-1.0.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file pdfservices_sdk_foxit-1.0.0.tar.gz.

File metadata

  • Download URL: pdfservices_sdk_foxit-1.0.0.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for pdfservices_sdk_foxit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 84494036c8725f0b985844c6e77f0514d770bbf5b8b0dde87bec78ce72b5d152
MD5 90a2274ecdd9a01bb9eb86abbe4eab97
BLAKE2b-256 161c28408d2ad11f4510b1ad99146091f23bb02a5656174f5a85d8819db278a7

See more details on using hashes here.

File details

Details for the file pdfservices_sdk_foxit-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pdfservices_sdk_foxit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b68ebb2ee5d562ebd11cc2dbfc75c7a7e9bf7995d9f952cc801e35a9afb3c331
MD5 9e364f72b3ac5803bac02520ec429c71
BLAKE2b-256 f8b1ed51b97ea8d5aad193cab4e0f1a810419b2b89cd4094c6057ad4b7583f14

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page