Developer Docs

Web Integrations

Integrate your website with our PDF tools

Open your files with our web tools

Here are some use-cases:

  1. Allow clients to easily fill out your PDF form, using our editor.
  2. Allow clients to sign a PDF doc and send it back to you by email.
  3. 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 code Click to try

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.

https://pdf2.cgp.systems/pdf-editor?files=[{"downloadUrl":"https://www.example.com/download/sample.pdf"}]

You'll need to URL encode the JSON value. Above code displays unencoded JSON for readability.

https://pdf2.cgp.systems/pdf-editor?files=%5B%7B%22downloadUrl%22%3A%22https%3A%2F%2Fwww.example.com%2Fdownload%2Fsample.pdf%22%7D%5D

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:

https://pdf2.cgp.systems/pdf-editor?files=[{"downloadUrl":"https://www.example.com/download/sample.pdf"}]&returnEmail=your@email.address

Remember to URL encode the email address value passed in:

&returnEmail=your%40email.address


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.

×
×