Developer Docs
Web Integrations
Integrate your website with our PDF tools
Open your files with our web tools
Here are some use-cases:
- Allow clients to easily fill out your PDF form, using our editor.
- Allow clients to sign a PDF doc and send it back to you by email.
- Provide a simple way for your clients to crop your PDF templates.
How it Works
The edited document will be sent back to this email address
Copy the above integration link and use it in your website or emails.
Need help setting it up? Please contact support.
Developer Setup
Input files
Input files can be passed as a GET
parameter, in JSON
format.
You'll need to URL encode
the JSON
value. Above code displays unencoded JSON
for readability.
An array of multiple files is accepted for certain tools (eg: merge, compress).
Return by email
To receive the edited documents back by email add a returnEmail
parameter to the URL:
Remember to URL encode the email address value passed in:
'Save to PDF' link for your web page
Let your visitors save pages from your website to PDF. Convert URLs to PDF.
How it works
The URL
is optional, can be automatically detected and works on any page without configuration.
More Options
List of All Options
Name | Description | |
save-link | Web page URL to convert to PDF. Eg: https://fs.blog . Defaults to the referring page. |
|
pageSize | One of the standard page sizes: a0 , a1 , a2 , a3 , a4 , a5 , letter , legal . Defaults to one long page. |
|
viewportWidth | The width, in pixels, for the rendered HTML page. Eg: 1440 . Defaults to browser's window.innerWidth |
|
pageOrientation | One of portrait , landscape or auto (default). Eg: auto |
|
pageMargin | Size of page margin, including units (px , in , cm or mm ). Eg: 100px . Defaults to no margin. |
API Docs
Hosted API, running on our servers (api.pdf2.cgp.systems)
Currently in BETA.
Pricing
Free to use within the free tier limits.
Paid API plans will be announced when going out of BETA.
Limits
Current limit is 30 requests per minute, max 4 concurrent requests.
Need more? Please get in touch.
Authentication
No account or api key required to get started with the free tier.
HTML to PDF
Convert HTML to PDF documents.
Get started
Run this CURL command in your console:
$> curl -i https://api.pdf2.cgp.systems/v1/tasks\ --fail --silent --show-error \ --header "Content-Type: application/json" \ --data '{"url": "https://csszengarden.com", "type": "htmlToPdf" }' > csszengarden_com.pdf
Endpoint URL
The API is organized around REST.
https://api.pdf2.cgp.systems/v1/tasks
Request
Make a POST
request with JSON
body:
Content-Type: application/json
Examples:
{"type":"htmlToPdf","url":"csszengarden.com"}
Converting HTML code (instead of an URL) to PDF:
{"type":"htmlToPdf","htmlCode":"HTM rules"}
HTML to PDF Options
Name | Type | Default | Description | |
url | string | optional | Web page URL to convert to PDF. | Eg: https://csszengarden.com |
htmlCode | string | optional | HTML source code to convert to PDF. | Eg: HTML rules |
pageSize | string |
one_long_page
|
one_long_page or one of the standard page sizes: a0 , a1 , a2 , a3 , a4 , a5 , letter , legal .
|
|
pageOrientation | string |
auto
|
landscape , portrait or auto .
|
|
viewportWidth | integer | optional | The width in pixels for the rendered web page. | Eg: 1600 |
pageMargin | double | optional | Specifies the size of the margin around the PDF page. To be used together with pageMarginUnits . |
Eg: 2.2 |
pageMarginUnits | string | optional | Specifies the units to be used for the margin size. One of px , in , cm or mm . To be used together with pageMargin . |
Eg: px for a margin size specified in pixels. |
hideNotices | boolean | false |
Attempt to automatically hide cookie notices and similar overlays. | Eg: true |
HTTP Response Codes
200 | All OK. Response contents will be the PDF document stream. |
429 | Rate limit reached. |
400 | Invalid request. |
500 | An error on our side. |
Other PDF tools?
API access for other PDF tools (crop, merge, compress, etc) is not yet available.