Python client for SelectPdf Online REST API
Project description
HTML To PDF API - Python Client
SelectPdf HTML To PDF Online REST API is a professional solution that lets you create PDF from web pages and raw HTML code in your applications. The API is easy to use and the integration takes only a few lines of code.
Features
- Create PDF from any web page or html string.
- Full html5/css3/javascript support.
- Set PDF options such as page size and orientation, margins, security, web page settings.
- Set PDF viewer options and PDF document information.
- Create custom headers and footers for the pdf document.
- Hide web page elements during the conversion.
- Automatically generate bookmarks during the html to pdf conversion.
- Support for partial page conversion.
- Easy integration, no third party libraries needed.
- Works in all programming languages.
- No installation required.
Sign up for for free to get instant API access to SelectPdf HTML to PDF API.
Installation
Download selectpdf-api-python-client-1.0.0.zip, unzip it and run:
cd selectpdf-api-python-client-1.0.0
python setup.py install
OR
Install SelectPdf Python Client for Online API via PyPI: SelectPdf on PyPI.
pip install selectpdf
OR
Clone selectpdf-api-python-client from Github and install the library.
git clone https://github.com/selectpdf/selectpdf-api-python-client
cd selectpdf-api-python-client
python setup.py install
Sample Code
import sys
import selectpdf
url = "https://selectpdf.com"
outFile = "test.pdf"
try:
api = selectpdf.HtmlToPdfClient("Your key here")
api.setPageSize(selectpdf.PageSize.A4)
api.setPageOrientation(selectpdf.PageOrientation.Portrait)
api.setMargins(0)
api.setNavigationTimeout(30)
api.setShowPageNumbers(False)
api.setPageBreaksEnhancedAlgorithm(True)
print ("Starting conversion...")
api.convertUrlToFile(url, outFile)
print ("Conversion finished successfully!")
usage = selectpdf.UsageClient("Your key here")
info = usage.getUsage(True)
print("Conversions left this month:", info["available"])
except selectpdf.ApiException as ex:
print ("An error occurred:", ex.getMessage())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
selectpdf-1.0.0.tar.gz
(11.0 kB
view hashes)
Built Distribution
selectpdf-1.0.0-py3-none-any.whl
(11.5 kB
view hashes)
Close
Hashes for selectpdf-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a813e9a95f53b5e6912ceca7a91e41827a49a08233fcd87f8d8dfcb11d2d44bb |
|
MD5 | 39bf2b5fe70f3a0580fe9b44134f51d7 |
|
BLAKE2b-256 | 5d04d108c7625669fd33edc59346ca1edbed6bd1b3478fdae4198b9c2c3e0bd7 |