mlapi
HomeBlog
  • Welcome
  • Extract Text from PDF
    • Parameters
    • Supported File types
    • Error Responses
    • Programming Languages
      • Python
      • Javascript
      • Curl
      • Java
      • Go
      • Rust
      • C++
    • Web and Mobile frameworks
      • React
      • React Native (Javascript)
      • HTML
      • PHP
      • Rust (with Active-Web)
      • Angular
      • Flutter
      • Andriod Development (Java)
      • Swift
      • Vue.js
      • Svelte
    • Pricing
    • On Premise Deployment
Powered by GitBook
On this page
  1. Extract Text from PDF
  2. Programming Languages

Python

PDF url

# extract text from pdf url
import requests

response = requests.post(
    'https://v1.mlapi.co/pdf/pdf-to-text',
    data={'pdf_url': 'https://pdfobject.com/pdf/sample.pdf', 'api_key': 'your_api_key'}
)

if response.status_code == 200:
    print(response.json())
else:
    print(f"Error: {response.status_code}, {response.text}")

Upload PDF file

# extract text from pdf file
import requests

with open('path/to/your-pdf.pdf', 'rb') as f:
    response = requests.post(
        'https://v1.mlapi.co/pdf/pdf-to-text',
        files={'file': f},
        data={'api_key': 'your_api_key'}
    )

if response.status_code == 200:
    print(response.json())
else:
    print(f"Error: {response.status_code}, {response.text}")
PreviousProgramming LanguagesNextJavascript

Last updated 9 months ago