forked from Api2Pdf/api2pdf.java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
558 lines (554 loc) · 20.3 KB
/
openapi.yaml
File metadata and controls
558 lines (554 loc) · 20.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
openapi: 3.0.0
servers:
- description: Api2Pdf.com API
url: https://v2018.api2pdf.com
info:
contact:
email: [email protected]
name: Support
x-twitter: api2pdf_status
description: |
# Introduction
[Api2Pdf](https://www.api2pdf.com) is a powerful PDF generation API with no rate limits or file size constraints. Api2Pdf runs on AWS Lambda, a serverless architecture powered by Amazon to scale to millions of requests while being up to 90% cheaper than alternatives. **Supports wkhtmltopdf, Headless Chrome, LibreOffice, and PDF Merge.** You can also generate barcodes with ZXING (Zebra Crossing).
# SDKs & Client Libraries
We've made a number of open source libraries available for the API
- Python: [https://github.com/api2pdf/api2pdf.python](https://github.com/api2pdf/api2pdf.python)
- .NET: [https://github.com/api2pdf/api2pdf.dotnet](https://github.com/api2pdf/api2pdf.dotnet)
- Nodejs: [https://github.com/api2pdf/api2pdf.node](https://github.com/api2pdf/api2pdf.node)
- PHP: [https://github.com/Api2Pdf/api2pdf.php](https://github.com/Api2Pdf/api2pdf.php)
- Ruby: (Coming soon)
# Authorization
Create an account at [portal.api2pdf.com](https://portal.api2pdf.com/register) to get an API key.
**Authorize your API calls**
- GET requests, include apikey=YOUR-API-KEY as a query string parameter
- POST requests, add **Authorization** to your header.
``` Authorization: YOUR-API-KEY ```
# Quickstart
If you are looking for just a quick call to grab PDFs of a URL, you can do a GET request like:
``` https://v2018.api2pdf.com/chrome/url?url={UrlToConvert}&apikey={YourApiKey} ```
For more advanced usage and settings, see the API specification below.
license:
name: Creative Commons
url: https://creativecommons.org/licenses/by/4.0/legalcode
title: Api2Pdf - PDF Generation, Powered by AWS Lambda
version: 1.0.0
x-apisguru-categories:
- developer_tools
x-logo:
url: https://twitter.com/api2pdf_status/profile_image?size=original
x-origin:
- converter:
url: https://github.com/lucybot/api-spec-converter
version: 2.7.18
format: openapi
url: https://app.swaggerhub.com/apiproxy/schema/file/api2pdf/api2pdf/1.0.0/swagger.json
version: "3.0"
x-providerName: api2pdf.com
externalDocs:
description: Find out more about Api2Pdf
url: https://www.api2pdf.com
security:
- HeaderApiKey: []
paths:
/chrome/html:
post:
description: |-
Convert HTML to a PDF using Headless Chrome on AWS Lambda.
### Authorize via Header of Request
**Authorization: YOUR-API-KEY**
operationId: chromeFromHtmlPost
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/ChromeHtmlToPdfRequest"
description: |-
A JSON object as a payload is required within the body of the request. The following attributes of the JSON object are detailed below:
- `html` *(string, required)* - raw HTML to convert to PDF
- `inlinePdf` *(boolean, optional)* - Open the PDF in a browser window. Default to false.
- `fileName` *(string, optional)* - Specify a file name for the output PDF. Random name if not specified.
- `options` *(object, optional)* - Include advanced Headless Chrome options like margins, headers, and footers. [See full list of advanced options here](https://www.api2pdf.com/documentation/advanced-options-headless-chrome/).
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseSuccess"
description: A JSON object containing the url to the PDF and other meta data
"401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseFailure"
description: Failed to generate PDF
summary: Convert raw HTML to PDF
tags:
- Headless Chrome
/chrome/url:
get:
description: |-
Convert a URL or Web Page to PDF using Headless Chrome on AWS Lambda. This GET request is for convenience and does not support advanced options. Use the POST request for more flexibility.
### Authorize via Query String Parameter
**apikey=YOUR-API-KEY**
### Example
``` https://v2018.api2pdf.com/chrome/url?url={UrlToConvert}&apikey={YourApiKey} ```
operationId: chromeFromUrlGET
parameters:
- description: Url of the page to convert to PDF. Must start with http:// or https://.
in: query
name: url
required: true
schema:
type: string
- description: Specify output=json to receive a JSON output. Defaults to PDF file.
in: query
name: output
schema:
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseSuccess"
application/pdf:
schema:
format: binary
type: string
description: A PDF file or a JSON object depending on the `output` query parameter
"401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseFailure"
description: Failed to generate PDF
security:
- QueryApiKey: []
summary: Convert URL to PDF
tags:
- Headless Chrome
post:
description: |-
Convert a URL or Web Page to PDF using Headless Chrome on AWS Lambda..
### Authorize via Header of Request
**Authorization: YOUR-API-KEY**
operationId: chromeFromUrlPost
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/ChromeUrlToPdfRequest"
description: |-
A JSON object as a payload is required within the body of the request. The following attributes of the JSON object are detailed below:
- `url` *(string, required)* - Url to the web page to convert to PDF
- `inlinePdf` *(boolean, optional)* - Open the PDF in a browser window. Default to false.
- `fileName` *(string, optional)* - Specify a file name for the output PDF. Random name if not specified.
- `options` *(object, optional)* - Include advanced Headless Chrome options like margins, headers, and footers. [See full list of advanced options here](https://www.api2pdf.com/documentation/advanced-options-headless-chrome/).
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseSuccess"
description: A JSON object containing the url to the PDF and other meta data
"401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseFailure"
description: Failed to generate PDF
summary: Convert URL to PDF
tags:
- Headless Chrome
/libreoffice/convert:
post:
description: |-
Convert an office document (Word, Excel, Powerpoint) or an image (jpg, gif, png) to a PDF using LibreOffice on AWS Lambda.
### Authorize via Header of Request
**Authorization: YOUR-API-KEY**
operationId: libreConvertPost
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/LibreOfficeConvertRequest"
description: |-
A JSON object as a payload is required within the body of the request. The following attributes of the JSON object are detailed below:
- `url` *(string, required)* - A direct URL to the file. Api2Pdf will consume the file at that URL and then convert it.
- `inlinePdf` *(boolean, optional)* - Open the PDF in a browser window. Default to false.
- `fileName` *(string, optional)* - Specify a file name for the output PDF. Random name if not specified.
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseSuccess"
description: A JSON object containing the url to the PDF and other meta data
"401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseFailure"
description: Failed to generate PDF
summary: Convert office document or image to PDF
tags:
- LibreOffice
/merge:
post:
description: |-
Merge two or more PDFs together on AWS Lambda.
### Authorize via Header of Request
**Authorization: YOUR-API-KEY**
operationId: mergePost
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/MergeRequest"
description: |-
A JSON object as a payload is required within the body of the request. The following attributes of the JSON object are detailed below:
- `urls` *(array of urls, required)* - A JSON array of direct URLs to PDFs. Api2Pdf will consume the PDF files in the list and then merge them all together..
- `inlinePdf` *(boolean, optional)* - Open the PDF in a browser window. Default to false.
- `fileName` *(string, optional)* - Specify a file name for the output PDF. Random name if not specified.
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseSuccess"
description: A JSON object containing the url to the PDF and other meta data
"401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseFailure"
description: Failed to generate PDF
summary: Merge multiple PDFs together
tags:
- Merge / Combine Pdfs
/wkhtmltopdf/html:
post:
description: |-
Convert HTML to a PDF using WkHtmlToPdf on AWS Lambda.
### Authorize via Header of Request
**Authorization: YOUR-API-KEY**
operationId: wkhtmltopdfFromHtmlPost
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/WkHtmlToPdfHtmlToPdfRequest"
description: |-
A JSON object as a payload is required within the body of the request. The following attributes of the JSON object are detailed below:
- `html` *(string, required)* - raw HTML to convert to PDF
- `inlinePdf` *(boolean, optional)* - Open the PDF in a browser window. Default to false.
- `fileName` *(string, optional)* - Specify a file name for the output PDF. Random name if not specified.
- `options` *(object, optional)* - Include advanced WkHtmlToPdf options like margins, headers, and footers. [See full list of advanced options here](https://www.api2pdf.com/documentation/advanced-options-wkhtmltopdf/).
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseSuccess"
description: A JSON object containing the url to the PDF and other meta data
"401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseFailure"
description: Failed to generate PDF
summary: Convert raw HTML to PDF
tags:
- wkhtmltopdf
/wkhtmltopdf/url:
get:
description: |-
Convert a URL or Web Page to PDF using WkHtmlToPdf on AWS Lambda. This GET request is for convenience and does not support advanced options. Use the POST request for more flexibility.
### Authorize via Query String Parameter
**apikey=YOUR-API-KEY**
### Example
``` https://v2018.api2pdf.com/wkhtmltopdf/url?url={UrlToConvert}&apikey={YourApiKey} ```
operationId: wkhtmltopdfFromUrlGET
parameters:
- description: Url of the page to convert to PDF. Must start with http:// or https://.
in: query
name: url
required: true
schema:
type: string
- description: Specify output=json to receive a JSON output. Defaults to PDF file.
in: query
name: output
schema:
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseSuccess"
application/pdf:
schema:
format: binary
type: string
description: A PDF file or a JSON object depending on the `output` query parameter
"401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseFailure"
description: Failed to generate PDF
security:
- QueryApiKey: []
summary: Convert URL to PDF
tags:
- wkhtmltopdf
post:
description: |-
Convert a URL or Web Page to PDF using WkHtmlToPdf on AWS Lambda..
### Authorize via Header of Request
**Authorization: YOUR-API-KEY**
operationId: wkhtmltopdfFromUrlPost
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/WkHtmlToPdfUrlToPdfRequest"
description: |-
A JSON object as a payload is required within the body of the request. The following attributes of the JSON object are detailed below:
- `url` *(string, required)* - Url to the web page to convert to PDF
- `inlinePdf` *(boolean, optional)* - Open the PDF in a browser window. Default to false.
- `fileName` *(string, optional)* - Specify a file name for the output PDF. Random name if not specified.
- `options` *(object, optional)* - Include advanced WkHtmlToPdf options like margins, headers, and footers. [See full list of advanced options here](https://www.api2pdf.com/documentation/advanced-options-wkhtmltopdf/).
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseSuccess"
description: A JSON object containing the url to the PDF and other meta data
"401":
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponseFailure"
description: Failed to generate PDF
summary: Convert URL to PDF
tags:
- wkhtmltopdf
/zebra:
get:
description: |-
See full list of options and documentation [here](https://www.api2pdf.com/documentation/advanced-options-zxing-zebra-crossing-barcodes/)
### Authorize via Query String Parameter
**apikey=YOUR-API-KEY**
### Example
``` https://v2018.api2pdf.com/zebra?format={format}&apikey={YourApiKey}&value={YourText} ```
operationId: zebraGET
parameters:
- description: Most common is CODE_39 or QR_CODE
in: query
name: format
required: true
schema:
type: string
- description: Specify the text value you want to convert
in: query
name: value
required: true
schema:
type: string
- description: Show label of text below barcode
in: query
name: showlabel
schema:
type: boolean
- description: Height of the barcode generated image
in: query
name: height
schema:
type: integer
- description: Width of the barcode generated image
in: query
name: width
schema:
type: integer
responses:
"200":
content:
image/png:
schema:
format: binary
type: string
description: An image of the generated barcode or QR code
security:
- QueryApiKey: []
summary: Generate bar codes and QR codes with ZXING.
tags:
- ZXING (Zebra Crossing) Bar Codes
components:
schemas:
ApiResponseFailure:
properties:
reason:
description: The reason for the PDF generation failure
example: Source website could not be found
type: string
success:
description: Will be false if the operation failed
example: false
type: boolean
type: object
ApiResponseSuccess:
properties:
cost:
description: Cost of the operation (mbIn + mbOut) * $.001
example: 0.0007979
type: number
mbIn:
description: The amount of megabytes of bandwidth used to process the pdf
example: 0.06463
type: number
mbOut:
description: The amount of megabytes of bandwidth generated from the resulting pdf
example: 0.73327
type: number
pdf:
description: A url to the PDF that will exist only for 24 hours
example: https://link-to-your-pdf
type: string
success:
description: Will be true if the operation suceeded
example: true
type: boolean
type: object
ChromeAdvancedOptions:
properties:
landscape:
example: "true"
type: string
printBackground:
example: false
type: boolean
type: object
ChromeHtmlToPdfRequest:
properties:
fileName:
example: test.pdf
type: string
html:
example: <p>Hello World</p>
format: html
type: string
inlinePdf:
example: true
type: boolean
options:
$ref: "#/components/schemas/ChromeAdvancedOptions"
required:
- html
type: object
ChromeUrlToPdfRequest:
properties:
fileName:
example: test.pdf
type: string
inlinePdf:
example: true
type: boolean
options:
$ref: "#/components/schemas/ChromeAdvancedOptions"
url:
example: https://www.github.com
format: url
type: string
required:
- url
type: object
LibreOfficeConvertRequest:
properties:
fileName:
example: test.pdf
type: string
inlinePdf:
example: true
type: boolean
url:
example: https://www.api2pdf.com/wp-content/themes/api2pdf/assets/samples/sample-word-doc.docx
format: url
type: string
required:
- url
type: object
MergeRequest:
properties:
fileName:
example: test.pdf
type: string
inlinePdf:
example: true
type: boolean
urls:
example:
- link-to-pdf1
- link-to-pdf2
- link-to-pdf3
format: list of urls to pdfs
items:
type: string
type: array
required:
- urls
type: object
WkHtmlToPdfAdvancedOptions:
properties:
orientation:
example: landscape
type: string
pageSize:
example: A4
type: string
type: object
WkHtmlToPdfHtmlToPdfRequest:
properties:
fileName:
example: test.pdf
type: string
html:
example: <p>Hello World</p>
format: html
type: string
inlinePdf:
example: true
type: boolean
options:
$ref: "#/components/schemas/WkHtmlToPdfAdvancedOptions"
required:
- html
type: object
WkHtmlToPdfUrlToPdfRequest:
properties:
fileName:
example: test.pdf
type: string
inlinePdf:
example: true
type: boolean
options:
$ref: "#/components/schemas/WkHtmlToPdfAdvancedOptions"
url:
example: https://www.github.com
format: url
type: string
required:
- url
type: object
securitySchemes:
HeaderApiKey:
in: header
name: Authorization
type: apiKey
QueryApiKey:
in: query
name: apikey
type: apiKey