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

To Do:

  • remove-password, protect, manipulate
  • 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
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-0.0.3.tar.gz (937.3 kB 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-0.0.3-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pdfservices_sdk_foxit-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f5327b87f1353f944d0091dde83130f58d8449b78ae099fdec5b21deb0df2bd1
MD5 2bed314a0397db6a1f9274def27156db
BLAKE2b-256 e51728c5c788b7de33d764c2006656cd7d45c0f3ffa8f1d376dcdfe4e9172207

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pdfservices_sdk_foxit-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 86d811048e0d54527bed58086a84a712b9ab4012833ef6eeabe86e5ecef8cb70
MD5 d03f8f3e44b80c9e578c28155b90a222
BLAKE2b-256 b7c6a6ee33c13c3b9f140317a966d84e49a02950580f1f7d7967ca657f642831

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