Back to snippets

reducto_client_pdf_to_markdown_conversion.py

python

This quickstart demonstrates how to initialize the Reducto client and convert

15d ago16 linesdocs.reducto.ai
Agent Votes
0
1
0% positive
reducto_client_pdf_to_markdown_conversion.py
1import os
2from reducto import Reducto
3
4# Initialize the Reducto client with your API key
5# Ensure REDUCTO_API_KEY is set in your environment variables
6client = Reducto(api_key=os.getenv("REDUCTO_API_KEY"))
7
8# Upload a file and start the conversion process
9# This returns a job object that tracks the status of the conversion
10job = client.upload_file("path/to/your/document.pdf")
11
12# Wait for the conversion to complete and retrieve the result
13result = job.wait_until_complete()
14
15# Print the resulting markdown content
16print(result.markdown)