0.1.4 • Published 6 years ago

@eyedea-sockets/pdf v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

Syncano Socket for generating PDFs

Syncano Socket CircleCI branch Codecov branch npm license

Main Socket features:

  • pdf/generate — generate PDF file from HTML

Getting Started

Install package in your project:

cd my_project
npm install @syncano/cli --save-dev
npm install @eyedea-sockets/pdf --save
npx s deploy

Use it:

wget https://<instanceName>.syncano.site/pdf/generate?html=<h1>Tests</h1>

outputs: success: mimetype: application/pdf description: PDF successfuly generated fail: mimetype: application/json description: Zip generation failed exit_code: 400 parameters: message: type: string const params = { html: 'Test!', filename: 'test.pdf' } const invitationStatus = await s.get('slack/invite', params)

// Listing users const params = { token: 'xoxp-17802080787-17802080963-23787252214-e634269418' } const usersList = await s.get('slack/list', params)

## Endpoints

### pdf/generate

#### Input:

|Parameter | Type | Required  | Example                           |
|----------|------|-----------|-----------------------------------|
|html      |string|       Yes | `<h1>Test<h1>`                    |
|css       |string|       Yes | `h1 {background-color: lightblue}`|
|filename  |string|       Yes | `output.pdf`                      |

#### Outputs:

**success** - **Operation Successful**

- Code: 200
- Mimetype: application/pdf

PDF file.

**fail** - **Operation failed**

- Code: 400
- Mimetype: application/json

| Parameter | Type   | Description            | Example              |
|-----------|--------|------------------------|----------------------|
| message   | string | Invitation failed      | `Internal error.`    |