Created
March 14, 2021 01:29
-
-
Save symisc/889f90b8f5c6df6e3232308f9a1006f8 to your computer and use it in GitHub Desktop.
Convert a PDF document to a high resolution JPEG/PNG image via the PixLab API - https://pixlab.io/cmd?id=pdftoimg.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
# Convert a PDF document to JPEG/PNG image via /pdftoimg endpoint - https://pixlab.io/cmd?id=pdftoimg | |
req = requests.get('https://api.pixlab.io/pdftoimg',params={ | |
'src':'https://www.getharvest.com/downloads/Invoice_Template.pdf', | |
'export': 'jpeg', | |
'key':'PIXLAB_API_KEY' # Grab your API Key from https://pixlab.io/dashboard | |
}) | |
reply = req.json() | |
if reply['status'] != 200: | |
print (reply['error']) | |
else: | |
print ("Link to the image output (Converted PDF page): "+ reply['link']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment