How to get PDF info from URL for PDF information API in Python and PDF.co Web API

Follow this simple tutorial to learn get PDF info from URL to have PDF information API in Python

These simple tutorials explain the code material for beginners and advanced programmers who are using Python. PDF.co Web API was designed to assist PDF information API in Python. PDF.co Web API is the Web API with a set of tools for documents manipulation, data conversion, data extraction, splitting and merging of documents. Includes image recognition, built-in OCR, barcode generation and barcode decoders to decode bar codes from scans, pictures and pdf.

The SDK samples displayed below below explain how to quickly make your application do PDF information API in Python with the help of PDF.co Web API. This sample code in Python is all you need. Just copy-paste it to the code editor, then add a reference to PDF.co Web API and you are ready to try it! You can use these Python sample examples in one or many applications.

Our website provides free trial version of PDF.co Web API that gives source code samples to assist with your Python project.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

GetPdfInfoFromUrl.py

      
import os import requests # pip install requests # The authentication key (API Key). # Get your own by registering at https://app.pdf.co/documentation/api API_KEY = "******************************************" # Base URL for PDF.co Web API requests BASE_URL = "https://api.pdf.co/v1" # Direct URL of PDF file to get information SourceFileURL = "https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-info/sample.pdf" def main(args=None): getInfoFromUrl(SourceFileURL) def getInfoFromUrl(uploadedFileUrl): """Get Information using PDF.co Web API""" # Prepare requests params as JSON # See documentation: https://apidocs.pdf.co parameters = {} parameters["url"] = uploadedFileUrl # Prepare URL for 'PDF Info' API request url = "{}/pdf/info".format(BASE_URL) # Execute request and get response as JSON response = requests.post(url, data=parameters, headers={ "x-api-key": API_KEY }) if (response.status_code == 200): json = response.json() if json["error"] == False: # Display information print(json["info"]) else: # Show service reported error print(json["message"]) else: print(f"Request error: {response.status_code} {response.reason}") if __name__ == '__main__': main()

VIDEO

ON-PREMISE OFFLINE SDK

Get 60 Day Free Trial

See also:

ON-DEMAND REST WEB API

Get Your API Key

See also:

Related Samples: