NAV
python

ຍິນດີຕ້ອນຮັບສູ່ເອກະສານ PDF.to API

ເພື່ອເອົາລະຫັດນັກພັດທະນາ, ກະລຸນາໄປທີ່ປະຕູນັກພັດທະນາ

Authorization: <api_key>

ແປງຈາກ PDF

PDF ເຖິງ DOCX

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-docx',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.docx

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ເຖິງ DOC

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-doc',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()
# ບີບອັດ PDF

## ບີບອັດ PDF

```python
import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-compress',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

get_results(convert_files(api_url, params, headers)) ```

ຈະກັບຄືນມາ

/path/to/local/file_processed.doc

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ເປັນ JPG

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-jpg',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.jpg

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ກັບ PNG

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-png',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.png

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ເຖິງ XLSX

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-xlsx',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.xlsx

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ເຖິງ XLS

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-xls',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.xls

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ເຖິງ PPTX

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-pptx',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pptx

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ກັບ PPT

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-ppt',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.ppt

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ກັບ TXT

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-txt',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.txt

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ເປັນ HTML

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-html',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.html

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ກັບ ODT

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-odt',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.odt

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ກັບ CSV

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-csv',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.csv

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ກັບ ePub

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-epub',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.epub

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ກັບ TIFF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-tiff',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.tiff

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ເຖິງ BMP

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-bmp',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.bmp

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ເຖິງ SVG

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-svg',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.svg

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ກັບ ZIP

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-zip',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.zip

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ກັບ WebP

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-webp',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.webp

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ກັບ GIF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-gif',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.gif

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PDF ເປັນ PSD

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-psd',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.psd

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

ແປງເປັນ PDF

DOCX ເຖິງ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.docx', 'testfiles/blah.docx', 'testfiles/blah.docx']
params = {
    'lang': 'en',
    'convert_to': 'docx-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

DOC ເຖິງ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'doc-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'xlsx-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

JPG ເຖິງ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'jpg-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PNG ເປັນ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'png-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PPTX ເຖິງ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pptx-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PPT ກັບ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'ppt-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

TXT ເຖິງ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.txt', 'testfiles/blah.txt', 'testfiles/blah.txt']
params = {
    'lang': 'en',
    'convert_to': 'txt-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

HTML ເຖິງ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.html', 'testfiles/blah.html', 'testfiles/blah.html']
params = {
    'lang': 'en',
    'convert_to': 'html-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

ODT ກັບ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.odt', 'testfiles/blah.odt', 'testfiles/blah.odt']
params = {
    'lang': 'en',
    'convert_to': 'odt-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

CSV ເປັນ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.csv', 'testfiles/blah.csv', 'testfiles/blah.csv']
params = {
    'lang': 'en',
    'convert_to': 'csv-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

ePub ເຖິງ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'epub-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

BMP ເຖິງ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.bmp', 'testfiles/blah.bmp', 'testfiles/blah.bmp']
params = {
    'lang': 'en',
    'convert_to': 'bmp-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

SVG ເຖິງ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.svg', 'testfiles/blah.svg', 'testfiles/blah.svg']
params = {
    'lang': 'en',
    'convert_to': 'svg-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

TIFF ເຖິງ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.tiff', 'testfiles/blah.tiff', 'testfiles/blah.tiff']
params = {
    'lang': 'en',
    'convert_to': 'tiff-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

WebP to PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'webp-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

GIF ເຖິງ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.gif', 'testfiles/blah.gif', 'testfiles/blah.gif']
params = {
    'lang': 'en',
    'convert_to': 'gif-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

PSD ເປັນ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.psd', 'testfiles/blah.psd', 'testfiles/blah.psd']
params = {
    'lang': 'en',
    'convert_to': 'psd-pdf',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ

ບີບອັດ PDF

ບີບອັດ PDF

import requests
import time
import shutil
import json

headers = {'Authorization': 'yourapikeyfoundinadmin'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
    'lang': 'en',
    'convert_to': 'pdf-compress',
    'ocr': False
}

api_url = 'https://api.pdf.to/v1/convert/'
results_url = 'https://api.pdf.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.pdf.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

ຈະກັບຄືນມາ

/path/to/local/file_processed.pdf

ເພື່ອເຮັດໃຫ້ຫຼາຍພຽງແຕ່ໃສ່ໄຟລ໌ຫຼາຍໃນບັນຊີລາຍຊື່ຂອງທ່ານ