You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python bindings for [Api2pdf REST API](https://www.api2pdf.com/documentation)
3
+
4
+
Api2Pdf.com is a REST API for instantly generating PDF documents from HTML, URLs, Microsoft Office Documents (Word, Excel, PPT), and images. The API also supports merge / concatenation of two or more PDFs. Api2Pdf is a wrapper for popular libraries such as **wkhtmltopdf**, **Headless Chrome**, and **LibreOffice**.
5
+
6
+
-[Installation](#installation)
7
+
-[Resources](#resources)
8
+
-[Authorization](#authorization)
9
+
-[Usage](#usage)
14
10
-[FAQ](#faq)
15
11
16
-
Api2Pdf provides access to **wkhtmltopdf**, **Headless Chrome**, and **LibreOffice**, along with the ability to merge / concatenate PDFs together.
17
12
13
+
## <aname="installation"></a>Add a dependency
14
+
15
+
### PyPI
16
+
17
+
Run the pip command for installing the client `pip install api2pdf`
18
18
19
+
## <aname="resources"></a>Resources
19
20
20
-
## <aname="get-started"></a>Get Started
21
-
This python library provides convenient methods for accessing the REST API [documented here](https://www.api2pdf.com/documentation/).
21
+
Resources this API supports:
22
+
23
+
-[wkhtmltopdf](#wkhtmltopdf)
24
+
-[Headless Chrome](#chrome)
25
+
-[LibreOffice](#libreoffice)
26
+
-[Merge / Concatenate PDFs](#merge)
27
+
-[Helper Methods](#helpers)
28
+
29
+
## <aname="authorization"></a>Authorization
22
30
23
31
### Acquire API Key
24
32
1. Create an account and login at [portal.api2pdf.com](https://portal.api2pdf.com)
25
33
2. Add a balance to your account (no monthly commitment, sign up with as little as $1)
26
34
3. Create an application and grab your API Key
27
-
28
-
### Install
29
-
pip install api2pdf
30
35
31
-
### Usage
36
+
## <aname="#usage"></a>Usage
37
+
38
+
### Initialize the Client
39
+
40
+
All usage starts by calling the import command and initializing the client by passing your API key as a parameter to the constructor.
An `Api2PdfResponse` object is returned from every API call. Call the `result` attribute to retrieve the data. If a call is unsuccessful then `success` will show False and the `error` will provide the reason for failure. Additional attributes include the total data usage in, out, and the cost for the API call.
53
+
An `Api2PdfResponse` object is returned from every API call. Call the `result` attribute to retrieve the data. If a call is unsuccessful then `success` will show False and the `error` will provide the reason for failure. Additional attributes include the total data usage in, out, and the cost for the API call, typically very small fractions of a penny.
### <aname="convert-from-html"></a>Convert HTML to PDF
81
+
### <aname="wkhtmltopdf"></a> wkhtmltopdf
73
82
74
-
We support both **wkhtmltopdf** and **Headless Chrome** with the endpoint to convert raw html to PDFs. Both endpoints allow you to pass keyword arguments that are options available for their respective libraries.
### <aname="convert-from-url"></a>Convert URL to PDF
108
+
**Convert URL to PDF (use keyword arguments for advanced wkhtmltopdf settings)**
109
+
[View full list of wkhtmltopdf options available.](https://www.api2pdf.com/documentation/advanced-options-wkhtmltopdf/)
106
110
107
-
We support both wkhtmltopdf and Headless Chrome with the endpoint to convert urls to PDFs. Both endpoints allow you to pass keyword arguments that are options available for their respective libraries.
###<aname="merge"></a>Merge / Concatenate Two or More PDFs
176
+
## <aname="merge"></a>Merge / Concatenate Two or More PDFs
166
177
167
178
To use the merge endpoint, supply a list of urls to existing PDFs. The engine will consume all of the PDFs and merge them into a single PDF, in the order in which they were provided in the list.
On any `Api2PdfResponse` that succesfully generated a pdf, you can use the handy download_pdf() method to download the pdf to a file-like object which you can then save to your local cache. If the pdf generation was unsuccessful, it will throw a FileNotFoundException.
196
+
On any `Api2PdfResponse` that succesfully generated a pdf, you can use the handy `download_pdf()` method to download the pdf to a file-like object which you can then save to your local cache. If the pdf generation was unsuccessful, it will throw a FileNotFoundException.
@@ -215,7 +218,7 @@ The average customer spents about $2/month on our product. We do not have free a
215
218
We do not have any long term contracts. You can leave us at anytime with no further commitments. As our minimum cost is $1.00, we do not provide refunds.
216
219
217
220
#### Are there any limits?
218
-
Api2Pdf does not set any specific limits on PDF file size, however our system does have processing power limitations. Each PDF request is provided 3 GB of RAM to work with and 110 seconds to generate the PDF. We offer WKHTMLTOPDF, Headless Chrome, and LibreOffice to do conversions. Our platform will have the same limits as those underlying components. If the underlying component fails to convert to PDF, it will also fail via our service. Some examples are:
221
+
Api2Pdf does not set any specific limits on PDF file size, however our system does have processing power limitations. Each PDF request is provided 3 GB of RAM to work with and 90 seconds to generate the PDF. We offer WKHTMLTOPDF, Headless Chrome, and LibreOffice to do conversions. Our platform will have the same limits as those underlying components. If the underlying component fails to convert to PDF, it will also fail via our service. Some examples are:
0 commit comments