Install & Compatibility
Where this runs
tested against v4.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.9
✕ build_error
✓ 5.85s
100MB installed
● package 100MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
PdfServiceClient
✓ from adobe.pdfservices.operation.pdf_services_client import PdfServiceClient
✗ from adobe.pdfservices.operation.pdf_services_client import PdfServiceClient
This quickstart demonstrates how to initialize the PDF Services client, authenticate using file-based credentials, and convert a simple HTML string to a PDF document. It highlights the use of `AdobeAuthCredentials` and `PdfServicesConfig` for setup, and `FileRef` for handling input/output files.
import os
from pdfservices_sdk.pdf_services_client import PdfServiceClient
from pdfservices_sdk.pdf_services_config import PdfServicesConfig
from pdfservices_sdk.auth.credentials import AdobeAuthCredentials
from pdfservices_sdk.io.file_ref import FileRef
from pdfservices_sdk.jobs.createpdf.create_pdf_from_html_job import CreatePdfFromHtmlJob
# Ensure you have your credentials.json file path set as an environment variable
# Or provide the path directly: credentials_path = "./pdfservices-api-credentials.json"
credentials_path = os.environ.get("PDF_SERVICES_SDK_CLIENT_CREDENTIALS_PATH", "./pdfservices-api-credentials.json")
# Create a dummy HTML file for conversion
dummy_html_content = "<h1>Hello from Adobe PDF Services!</h1><p>This is a test.</p>"
with open("input.html", "w") as f:
f.write(dummy_html_content)
try:
# 1. Build AdobeAuthCredentials using a file-based builder.
# Ensure credentials.json has 'client_id', 'client_secret', and 'organization_id'.
credentials = AdobeAuthCredentials.file_based_credentials_builder()\
.with_credentials_path(credentials_path).build()
# 2. Build PdfServicesConfig with the created credentials.
pdf_services_config = PdfServicesConfig.builder().with_credentials(credentials).build()
# 3. Create a PdfServiceClient.
pdf_service_client = PdfServiceClient.builder().with_pdf_services_config(pdf_services_config).build()
# 4. Create an input FileRef from the HTML file.
input_file_ref = FileRef.from_local_file("input.html")
# 5. Create a CreatePdfFromHtmlJob instance.
create_pdf_from_html_job = CreatePdfFromHtmlJob(input_file_ref)
# 6. Execute the job and get the output FileRef.
result_file_ref = pdf_service_client.execute(create_pdf_from_html_job)
# 7. Save the result to a local file.
output_path = "output.pdf"
result_file_ref.save_as_file(output_path)
print(f"Successfully created PDF: {output_path}")
except Exception as e:
print(f"An error occurred: {e}")
finally:
# Clean up dummy files
if os.path.exists("input.html"):
os.remove("input.html")
# if os.path.exists("output.pdf"):
# os.remove("output.pdf") # Uncomment to remove generated PDF after successful run
Upgrade
Version history
4.2.0latest on PyPI · released Jul 10, 2025
Audit
Dependencies
pythonrequiredRequires Python 3.10 or higher.