Skip to content

Commit cd38066

Browse files
authored
fix formatting of readme
1 parent 4252407 commit cd38066

File tree

1 file changed

+43
-39
lines changed

1 file changed

+43
-39
lines changed

README.md

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,18 @@ We support both **wkhtmltopdf** and **Headless Chrome** with the endpoint to con
8989
- [wkhtmltopdf options](https://www.api2pdf.com/documentation/advanced-options-wkhtmltopdf/)
9090
- [headless chrome options](https://www.api2pdf.com/documentation/advanced-options-headless-chrome/)
9191

92-
93-
94-
from api2pdf import Api2Pdf
95-
a2p = Api2Pdf('YOUR-API-KEY')
92+
```
93+
from api2pdf import Api2Pdf
94+
a2p = Api2Pdf('YOUR-API-KEY')
9695
97-
# headless chrome
98-
headless_chrome_result = a2p.HeadlessChrome.convert_from_html('<p>Hello World</p>')
99-
print(headless_chrome_result.result)
96+
# headless chrome
97+
headless_chrome_result = a2p.HeadlessChrome.convert_from_html('<p>Hello World</p>')
98+
print(headless_chrome_result.result)
10099
101-
# wkhtmltopdf
102-
wkhtmltopdf_result = a2p.WkHtmlToPdf.convert_from_html('<p>Hello World</p>')
103-
print(wkhtmltopdf_result.result)
100+
# wkhtmltopdf
101+
wkhtmltopdf_result = a2p.WkHtmlToPdf.convert_from_html('<p>Hello World</p>')
102+
print(wkhtmltopdf_result.result)
103+
```
104104

105105
### <a name="convert-from-url"></a>Convert URL to PDF
106106

@@ -123,18 +123,18 @@ We support both wkhtmltopdf and Headless Chrome with the endpoint to convert url
123123
- [wkhtmltopdf options](https://www.api2pdf.com/documentation/advanced-options-wkhtmltopdf/)
124124
- [headless chrome options](https://www.api2pdf.com/documentation/advanced-options-headless-chrome/)
125125

126-
127-
128-
from api2pdf import Api2Pdf
129-
a2p = Api2Pdf('YOUR-API-KEY')
126+
```
127+
from api2pdf import Api2Pdf
128+
a2p = Api2Pdf('YOUR-API-KEY')
130129
131-
# headless chrome
132-
headless_chrome_result = a2p.HeadlessChrome.convert_from_url('https://LINK-TO-YOUR-WEBSITE')
133-
print(headless_chrome_result.result)
130+
# headless chrome
131+
headless_chrome_result = a2p.HeadlessChrome.convert_from_url('https://LINK-TO-YOUR-WEBSITE')
132+
print(headless_chrome_result.result)
134133
135-
# wkhtmltopdf
136-
wkhtmltopdf_result = a2p.WkHtmlToPdf.convert_from_url('https://LINK-TO-YOUR-WEBSITE')
137-
print(wkhtmltopdf_result.result)
134+
# wkhtmltopdf
135+
wkhtmltopdf_result = a2p.WkHtmlToPdf.convert_from_url('https://LINK-TO-YOUR-WEBSITE')
136+
print(wkhtmltopdf_result.result)
137+
```
138138

139139
### <a name="convert-from-office"></a>Convert Microsoft Office Documents and Images to PDF
140140

@@ -154,12 +154,13 @@ You must provide a url to the file. Our engine will consume the file at that URL
154154

155155
`file_name <string> (optional, default=None)` - specify an optional file name like "report-03012019.pdf".
156156

157-
158-
from api2pdf import Api2Pdf
159-
a2p = Api2Pdf('YOUR-API-KEY')
157+
```
158+
from api2pdf import Api2Pdf
159+
a2p = Api2Pdf('YOUR-API-KEY')
160160
161-
libreoffice_result = a2p.LibreOffice.convert_from_html('https://LINK-TO-YOUR-FILE')
162-
print(libreoffice_result.result)
161+
libreoffice_result = a2p.LibreOffice.convert_from_html('https://LINK-TO-YOUR-FILE')
162+
print(libreoffice_result.result)
163+
```
163164

164165
### <a name="merge"></a>Merge / Concatenate Two or More PDFs
165166

@@ -170,30 +171,33 @@ To use the merge endpoint, supply a list of urls to existing PDFs. The engine wi
170171
*Paramaters:*
171172

172173
`list_of_urls <list>` - list of urls to pdfs
174+
175+
```
176+
from api2pdf import Api2Pdf
177+
a2p = Api2Pdf('YOUR-API-KEY')
173178
174-
from api2pdf import Api2Pdf
175-
a2p = Api2Pdf('YOUR-API-KEY')
176-
177-
# merge pdfs
178-
links_to_pdfs = ['https://LINK-TO-PDF', 'https://LINK-TO-PDF']
179-
merge_result = a2p.merge(links_to_pdfs)
180-
print(merge_result.result)
179+
# merge pdfs
180+
links_to_pdfs = ['https://LINK-TO-PDF', 'https://LINK-TO-PDF']
181+
merge_result = a2p.merge(links_to_pdfs)
182+
print(merge_result.result)
183+
```
181184

182185
### <a name="helper-methods"></a>Helper Methods
183186

184187
##### Api2PdfResponse: download_pdf()
185188

186189
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.
187190

188-
from api2pdf import Api2Pdf
189-
a2p = Api2Pdf('YOUR-API-KEY')
190-
191-
# merge pdfs
192-
links_to_pdfs = ['https://LINK-TO-PDF', 'https://LINK-TO-PDF']
193-
merge_result = a2p.merge(links_to_pdfs)
191+
```
192+
from api2pdf import Api2Pdf
193+
a2p = Api2Pdf('YOUR-API-KEY')
194194
195-
pdf_as_file_object = merge_result.download_pdf()
195+
# merge pdfs
196+
links_to_pdfs = ['https://LINK-TO-PDF', 'https://LINK-TO-PDF']
197+
merge_result = a2p.merge(links_to_pdfs)
196198
199+
pdf_as_file_object = merge_result.download_pdf()
200+
```
197201

198202
## <a name="faq"></a>FAQ
199203

0 commit comments

Comments
 (0)