Media-Services

Alvine Juno Dokumentation

You can try Alvine Juno easily and quickly!

Risk-free and at no additional cost. Take the URL of an HTML invoice or any other HTML document. If you don't have a document at hand, just take simply the URL from our example.

Astronaut studiert

API

functionality

Juno provides a simple REST API for creating PDF documents. All endpoints (URLs) expect to receive a POST request with a JSON document in the body. In the JSON document, depending on the endpoint, the necessary parameters are passed.

Below is a description of each endpoint and examples of how Juno integrates with specific Environment. If you miss your preferred development environment, you can find in our Postman documentation for many more examples. Using Postman, you can also test our API entirely without a development environment.

Authentication

The authentication of our service is done by a cryptographic key, which must be included in the header of each request. We use for the Authorization header for the transmission. The structure of the header is Authorization: api-key <key>.

You will receive your personal access key from us after agreeing to the terms of use. Write us a email or contact us via our chat. You can test our services after that within your free account.

Endpoints

With the capture endpoint /capture you can create a PDF document from one or multiple web pages into a PDF document, using the convert endpoint /convert an existing Office document (Word, Excel, PowerPoint, LibreOffice, OpenOffice) can be converted into a PDF and with the create endpoint /create PDF documents can be can be created using a JSON specification.

All endpoints expect a POST request with a JSON document in the body.

Below is a description of each endpoint and examples of how Juno integrates with specific Environment. If you miss your preferred development environment, you can find in our Postman documentation for many more examples. Using Postman, you can also test our API entirely without a development environment.

The capture endpoint /capture can be used to convert web pages into PDF documents. documents.

Call

All Alvine Cloud API endpoints are documented in Postman.

You can try the API directly (external page):

Environment

The individual APIs are created in Postman with placeholders. The placeholders can be be set via the environment function.

placeholderValueDescription
JUNO URLhttps://juno.alvine.cloud/The URL of the service
curl --location --request POST 'https://juno.alvine.cloud/api/v1/capture' \
--header 'Accept: application/json' \
--header 'Authorization: api-key EVALUATION' \
--header 'Content-Type: application/json' \
--data-raw '{
    "page-size": "A4",
    "dpi": 36,
    "orientation": "Portrait",
    "pages": [
        {
            "url": "https://www.schukai.com/",
            "zoom": 1.0,
            "print-media-type": true,
            "viewport-width": "1280x1024",
            "load-media-error-handling": "abort",
            "load-error-handling": "abort",
            "encoding": "utf-8",
            "auth": {
                "base-auth": {
                    "username": "name",
                    "password": "geheim"
                }
            }
        },
        {
            "url": "https://www.schukai.com/de/verkaufen/"
        }
    ],
    "margins": {
        "top": 5,
        "left": 5,
        "right": 5,
        "bottom": 5
    },
    "operators": {
        "smart-shrinking": true,
        "grayscale": true
    }
}'            
        
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://juno.alvine.cloud/api/v1/capture"
  method := "POST"

  payload := strings.NewReader(`{
    "page-size": "A4",
    "dpi": 36,
    "orientation": "Portrait",
    "pages": [
        {
            "url": "https://www.schukai.com/",
            "zoom": 1.0,
            "print-media-type": true,
            "viewport-width": "1280x1024",
            "load-media-error-handling": "abort",
            "load-error-handling": "abort",
            "encoding": "utf-8",
            "auth": {
                "base-auth": {
                    "username": "name",
                    "password": "geheim"
                }
            }
        },
        {
            "url": "https://www.schukai.com/de/verkaufen/"
        }
    ],
    "margins": {
        "top": 5,
        "left": 5,
        "right": 5,
        "bottom": 5
    },
    "operators": {
        "smart-shrinking": true,
        "grayscale": true
    }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Accept", "application/json")
  req.Header.Add("Authorization", "api-key EVALUATION")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
        
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "api-key EVALUATION");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "page-size": "A4",
  "dpi": 36,
  "orientation": "Portrait",
  "pages": [
    {
      "url": "https://www.schukai.com/",
      "zoom": 1,
      "print-media-type": true,
      "viewport-width": "1280x1024",
      "load-media-error-handling": "abort",
      "load-error-handling": "abort",
      "encoding": "utf-8",
      "auth": {
        "base-auth": {
          "username": "name",
          "password": "geheim"
        }
      }
    },
    {
      "url": "https://www.schukai.com/de/verkaufen/"
    }
  ],
  "margins": {
    "top": 5,
    "left": 5,
    "right": 5,
    "bottom": 5
  },
  "operators": {
    "smart-shrinking": true,
    "grayscale": true
  }
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://juno.alvine.cloud/api/v1/capture", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
        

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://juno.alvine.cloud/api/v1/capture',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "page-size": "A4",
    "dpi": 36,
    "orientation": "Portrait",
    "pages": [
        {
            "url": "https://www.schukai.com/",
            "zoom": 1.0,
            "print-media-type": true,
            "viewport-width": "1280x1024",
            "load-media-error-handling": "abort",
            "load-error-handling": "abort",
            "encoding": "utf-8",
            "auth": {
                "base-auth": {
                    "username": "name",
                    "password": "geheim"
                }
            }
        },
        {
            "url": "https://www.schukai.com/de/verkaufen/"
        }
    ],
    "margins": {
        "top": 5,
        "left": 5,
        "right": 5,
        "bottom": 5
    },
    "operators": {
        "smart-shrinking": true,
        "grayscale": true
    }
}',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Authorization: api-key EVALUATION',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
            
        
Answer

In response to a request, if successful, you will receive the status code 200, the Header ContentType: application/pdf and in the body, the binary data of the PDF document.

In the event of an error, you will receive a status code greater than or equal to 400, the header ContentType: application/json and in the body a JSON document with further information about the error.

Example

In the following example, the two HTML pages https://www.schukai.com/ and https://www.schukai.com/de/verkaufen/ are printed in a DIN-A4 PDF.

    
{
    "page-size": "A4",
    "dpi": 36,
    "orientation": "Portrait",
    "pages": [
        {
            "url": "https://www.schukai.com/",
            "zoom": 1.0,
            "print-media-type": true,
            "viewport-width": "1280x1024",
            "load-media-error-handling": "abort",
            "load-error-handling": "abort",
            "encoding": "utf-8",
            "auth": {
                "base-auth": {
                    "username": "name",
                    "password": "geheim"
                }
            }
        },
        {
            "url": "https://www.schukai.com/de/verkaufen/"
        }
    ],
    "margins": {
        "top": 5,
        "left": 5,
        "right": 5,
        "bottom": 5
    },
    "operators": {
        "smart-shrinking": true,
        "grayscale": true
    }
}    
    
Options

The following is an overview of all options

FieldDescriptionTypeValid valuesMandatory fieldStandard
pages.urlURL to the desired web page. Javascript is not supported during the test phase.stringYes
page-sizeSize of the page StringA4, A5, ...NoA4
orientationorientation to landscape (Landscape) or portrait (Portrait)stringLandscape, PortraitNoPortrait
dpiChanges the DPIInteger1...No36
pages.zoomZoom factorFloat0.1...No1.0
pages.print-media-typeApply mediaquery @printBooleantrue, falseNotrue
pages.viewport-widthSets the viewport sizeStringNo1280x1024
pages.load-media-error-handlingabort or ignore if images or CSS are missingstringabort, ignoreNoabort
pages.load-error-handlingabort (abort) or ignore (ignore) if the url is not foundstringabort, ignoreNoabort
pages.encodingdefault encodingstring utf-8, is-8859-1, ...Noutf-8
pages.auth.header.type
pages.auth.header.credential
Login with Authorization header
Type is mostly basic or baerer (for other types see http-authschemes )
and password
stringNo
pages.auth.base-auth.username
pages.auth.base-auth.password
Login with base-auth
username and password
stringNo
pages.auth.cookie.name
pages.auth.cookie.credential
Login with session cookie
name of cookie and sessionID
StringNo
margins.top
margins.bottom
margins.left
margins.right
Distance to marginintegerNo5
operators.smart-shrinkingSmart-shrinking the web page to PDF formatBooleantrue, falseNotrue
operators.grayscaleApply grayscale filterBooleantrue, falseNotrue

The convert endpoint /convert can be used to convert Office documents (Word, Excel, Powerpoint, Libreoffice, OpenOffice) into PDF documents.

Call

All Alvine Cloud API endpoints are documented in Postman.

You can try the API directly (external page):

Environment

The individual APIs are created in Postman with placeholders. The placeholders can be be set via the environment function.

placeholderValueDescription
JUNO URLhttps://juno.alvine.cloud/The URL of the service
curl --location --request POST 'https://juno.alvine.cloud/api/v1/convert' \
--header 'Accept: application/json' \
--header 'Authorization: api-key EVALUATION' \
--header 'Content-Type: application/json' \
--data-raw '{
    "url": "https://www.alvine.cloud/examples/welcome.docx"
}'
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://juno.alvine.cloud/api/v1/convert"
  method := "POST"

  payload := strings.NewReader(`{
    "url": "https://www.alvine.cloud/examples/welcome.docx"
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Accept", "application/json")
  req.Header.Add("Authorization", "api-key EVALUATION")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
        
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "api-key EVALUATION");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "url": "https://www.alvine.cloud/examples/welcome.docx"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://juno.alvine.cloud/api/v1/convert", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
        
            
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://juno.alvine.cloud/api/v1/convert',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "url": "https://www.alvine.cloud/examples/welcome.docx"
}',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Authorization: api-key EVALUATION',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

        
Answer

In response to a request, if successful, you will receive the status code 200, the the header ContentType: application/pdf and in the body, the binary data of the PDF document.

In the event of an error, you will receive a status code greater than or equal to 400, the header ContentType: application/json and in the body a JSON document with further information about the error.

Example

In the following example, the URL https://www.alvine.cloud/examples/welcome.docx is converted into a PDF document. document.

    
{
    "url": "https://www.alvine.cloud/examples/welcome.docx"
}
    
Options

The following is an overview of all options

FieldDescriptionTypeValid valuesMandatory fieldStandard
urlURL to the document to be converted.stringYes

The create endpoint /create allows PDF documents to be created based on a Create specification.

call

All Alvine cloud API endpoints are documented in Postman.

You can try the API directly (external page):

Environment

The individual API are created in Postman with placeholders. The placeholders can be be set using the environment function.

placeholdervaluedescription
JUNO URLhttps://juno.alvine.cloud/The URL of the service
curl --location --request POST 'https://juno.alvine.cloud/api/v1/create' \
--header 'Accept: application/json' \
--header 'Authorization: api-key EVALUATION' \
--header 'Content-Type: application/json' \
--data-raw '{
"author": "schukai GmbH",
"title": "Demopaper",
"subject": "this is a example pdf",
"page-size": {
"unit": "mm",
"width": 291,
"height": 210
},
"fonts": [
{
"name": "RobotoX",
"url": "https://cdn.jsdelivr.net/npm/rubik-font@0.0.3/fonts/Rubik-Light.ttf",
"kerning": true
}
],
"templates": [
{
"url": "https://cdn.alvine.io/examples/alvine-cloud-website.pdf",
"page": 1,
"name": "website",
"box": "/MediaBox"
}
],
"pages": [
{
"outline": "This is a bookmark",
"objects": [
{
"type": "template",
"name": "website",
"x": 0,
"y": 0,
"width": 148
},
{
"type": "textbox",
"x1": 170,
"y1": 30,
"x2": 270,
"y2": 180,
"border": {
"color": {
"r": 255,
"g": 0,
"b": 0
}
},
"text": {
"text": "Text with Linefeed",
"valign": "top"
}
},
{
"type": "text",
"text": "Lorem ipsum dolor sit amet, consetetur\nsadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"x": 180,
"y": 50,
"font": "RobotoX",
"width": 80
},
{
"type": "image",
"url": "https://alvine.io/alvine.png",
"x": 5,
"y": 5,
"width": 40,
"height": 10
}
]
}
]
}'
package main

import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)

func main() {
    url: =
    "https://juno.alvine.cloud/api/v1/create"
    method: =
    "POST"

    payload: =
    strings.NewReader(
    `{
    "author": "schukai GmbH",
    "title": "Demopaper",
    "subject": "this is a example pdf",
    "page-size": {
        "unit": "mm",
        "width": 291,
        "height": 210
    },
    "fonts": [
        {
            "name": "RobotoX",
            "url": "https://cdn.jsdelivr.net/npm/rubik-font@0.0.3/fonts/Rubik-Light.ttf",
            "kerning": true
        }
    ],
    "templates": [
        {
            "url": "https://cdn.alvine.io/examples/alvine-cloud-website.pdf",
            "page": 1,
            "name": "website",
            "box": "/MediaBox"
        }
    ],
    "pages": [
        {
            "outline": "This is a bookmark",
            "objects": [
                {
                    "type": "template",
                    "name": "website",
                    "x": 0,
                    "y": 0,
                    "width": 148
                },
                {
                    "type": "textbox",
                    "x1": 170,
                    "y1": 30,
                    "x2": 270,
                    "y2": 180,
                    "border": {
                        "color": {
                            "r": 255,
                            "g": 0,
                            "b": 0
                        }
                    },
                    "text": {
                        "text": "Text with Linefeed",
                        "valign": "top"
                    }
                },
                {
                    "type": "text",
                    "text": "Lorem ipsum dolor sit amet, consetetur\nsadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
                    "x": 180,
                    "y": 50,
                    "font": "RobotoX",
                    "width": 80
                },
                {
                    "type": "image",
                    "url": "https://alvine.io/alvine.png",
                    "x": 5,
                    "y": 5,
                    "width": 40,
                    "height": 10
                }
            ]
        }
    ]
}`)

client: = &http.Client {
}
req, err: = http.NewRequest(method, url, payload)

if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "api-key EVALUATION")
req.Header.Add("Content-Type", "application/json")

res, err: = client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()

body, err : = ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
        
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "api-key EVALUATION");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"author": "schukai GmbH",
"title": "Demopaper",
"subject": "this is a example pdf",
"page-size": {
"unit": "mm",
"width": 291,
"height": 210
},
"fonts": [
{
"name": "RobotoX",
"url": "https://cdn.jsdelivr.net/npm/rubik-font@0.0.3/fonts/Rubik-Light.ttf",
"kerning": true
}
],
"templates": [
{
"url": "https://cdn.alvine.io/examples/alvine-cloud-website.pdf",
"page": 1,
"name": "website",
"box": "/MediaBox"
}
],
"pages": [
{
"outline": "This is a bookmark",
"objects": [
{
"type": "template",
"name": "website",
"x": 0,
"y": 0,
"width": 148
},
{
"type": "textbox",
"x1": 170,
"y1": 30,
"x2": 270,
"y2": 180,
"border": {
"color": {
"r": 255,
"g": 0,
"b": 0
}
},
"text": {
"text": "Text with Linefeed",
"valign": "top"
}
},
{
"type": "text",
"text": "Lorem ipsum dolor sit amet, consetetur\nsadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"x": 180,
"y": 50,
"font": "RobotoX",
"width": 80
},
{
"type": "image",
"url": "https://alvine.io/alvine.png",
"x": 5,
"y": 5,
"width": 40,
"height": 10
}
]
}
]
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://juno.alvine.cloud/api/v1/create", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
        
$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://juno.alvine.cloud/api/v1/create',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"author": "schukai GmbH",
"title": "Demopaper",
"subject": "this is a example pdf",
"page-size": {
"unit": "mm",
"width": 291,
"height": 210
},
"fonts": [
{
"name": "RobotoX",
"url": "https://cdn.jsdelivr.net/npm/rubik-font@0.0.3/fonts/Rubik-Light.ttf",
"kerning": true
}
],
"templates": [
{
"url": "https://cdn.alvine.io/examples/alvine-cloud-website.pdf",
"page": 1,
"name": "website",
"box": "/MediaBox"
}
],
"pages": [
{
"outline": "This is a bookmark",
"objects": [
{
"type": "template",
"name": "website",
"x": 0,
"y": 0,
"width": 148
},
{
"type": "textbox",
"x1": 170,
"y1": 30,
"x2": 270,
"y2": 180,
"border": {
"color": {
"r": 255,
"g": 0,
"b": 0
}
},
"text": {
"text": "Text with Linefeed",
"valign": "top"
}
},
{
"type": "text",
"text": "Lorem ipsum dolor sit amet, consetetur\\nsadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"x": 180,
"y": 50,
"font": "RobotoX",
"width": 80
},
{
"type": "image",
"url": "https://alvine.io/alvine.png",
"x": 5,
"y": 5,
"width": 40,
"height": 10
}
]
}
]
}',
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Authorization: api-key EVALUATION',
'Content-Type: application/json'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

        
answer

In response to a request, if successful, you will receive the status code 200, the header ContentType: application/pdf and in the body the binary data of the PDF document.

In case of error you will get a status code greater than or equal to 400, the header ContentType: application/json and in the body a JSON document with further Information about the error.

Example

In the following example, an A4 PDF document with the character set Rubik Light, an astronaut, and the font Alvine Cloud.

       {
           "author": "schukai GmbH",
           "title": "Demopaper",
           "subject": "this is a example pdf",
           "page-size": {
               "unit": "mm",
               "width": 210,
               "height": 291
           },
           "fonts": [
               {
                   "name": "RubikLight",
                   "url": "https://cdn.jsdelivr.net/npm/rubik-font@0.0.3/fonts/Rubik-Light.ttf",
                   "kerning": true
               }
           ],
           "pages": [
               {
                   "objects": [
                       {
                           "type": "textbox",
                           "x1": 0,
                           "y1": 10,
                           "x2": 210,
                           "y2": 20,
                           "text": {
                               "text": "Alvine Cloud",
                               "valign": "top",
                               "size": 25,
                               "font": "RubikLight"
                           }
                       },
                       {
                           "type": "image",
                           "url": "https://cdn.alvine.io/examples/astronaut.png",
                           "x": 40,
                           "y": 25
                       }
                   ]
               }
           ]
       }
        
Password protection

Password protection can be created using the following structure. In the example. after entering the user password 23456. the PDF can be opened and edited, but not printed.

   
{
    "protection": {
        "permissions": {
            "print": false,
            "copy": true,
            "modify": true,
            "annotations-forms": true
        },
        "password": {
            "owner": "12345",
            "user": "23456"
        }
    }
}
    
templates

Other PDF documents can be integrated into a page as templates. For example, you can create an Invoice document with logo, address and footer and import it onto a page. The items are then filled in using text boxes. The PDF templates, like other objects, are imported via the the object key into the page. However, templates must be registered at the be registered at the top level.

   
{
    "templates": [
        {
            "url": "https://www.example.com/paper.pdf",
            "page": 1,
            "name": "mytemplate",
            "box": "/MediaBox"
        }
    ]
}
    

This template can now be used on all pages in the objects section via the Name, here in the example mytemplate, can be included. For details on how to include it on a page, see the section template.

        
{
    "type": "template",
    "name": "mytemplate",
    "x": 200,
    "width": 400
}
    
Options

The following is an overview of all options.

fielddescriptiontypevalid valuesmandatory fieldstandard
pages.titletitle of the documentstringno
pages.subjectsubject of the documentstringno
pages.authorauthor of the PDFstringno
font.nameName of the TTF font, the name can be used to assign the font to a text blockstringyes
font.urlURL of the font filestringyes
font.kerninguse kerningboolnotrue
protection.permissions.print
protection.permissions.copy
protection.permissions.modify
protection.permissions.annotations-forms
Permission for user access to print, copy, modify the document and permission for form and annotationsbooltrue/falsenofalse
protection.password.owner
protection.password.user
Main and user password. The document will be locked only if a user password has been defined has been defined. If no user password is defined, a random value is defined.stringno
pages.outlinelabel of the bookmark of the pagestringno
pages.template.urlURL of a PDF that can be used as a template for the pagestringno
pages.template.pagePage to be taken from templateintno1
pages.template.namename under which this template will be registeredstringyes
pages.template.boxname of the box to importstringno/MediaBox
pages.objectsobjects of a pageobjectno
pages.objects.typetype of an objectstring oval, line, image, textno
object options

The following is a description of the options for each object. Starting with a simple text.

    {
        "objects": [
            {
                "type": "text",
                "x": 10,
                "y": 10,
                "text": "Ein neues Buch, ein neues Jahr was werden die Tage bringen?",
                "color": {
                    "r": 0,
                    "g": 123,
                    "b": 145
                },
                "rotate": {
                    "angle": -25
                }
            }
        ]
    }

The result in the PDF looks like this:

Text

You can also integrate multiline text with the text object. For this the parameter width must be given. If the text does not fit into the defined width, it will be wrapped. In the text with the \n character to specify a line break.

The line height can be defined with the line-height parameter.

    {
        "objects": [
            {
                "type": "text",
                "text": "Lorem ipsum dolor sit amet, consetetur\nsadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
                "width": 300
            }
        ]
    }

The result in the PDF looks like this:

Text with line break
fielddescriptiontypevalid valuesmandatory fieldstandard
x1
y1
coordinatesfloatyes
texttext to be outputstringno
color.r
color.g
color.b
colors of the font (red, green and blue)intno0, 0, 0
fontName of the font to use, as specified in the page definition.stringno
sizesize of the fontintno14
widthwidth of the textfloatno
line-heightline-heightfloatno
rotate.angletilt of the text in degreesint-365 ... 365no0

The following is a description of the options for each object. Starting with a simple textbox.

    {
        "objects": [
            {
                "type": "textbox",
                "x1": 10,
                "y1": 10,
                "x2": 90,
                "y2": 90,
                "fill": {
                    "color": {
                        "r": 210,
                        "g": 210,
                        "b": 210
                    }
                },
                "text": {
                    "text": "Bonjour !",
                    "color": {
                        "r": 0,
                        "g": 0,
                        "b": 0
                    },
                    "align": "center",
                    "valign": "middle"
                },
                "border": {
                    "color": {
                        "r": 94,
                        "g": 0,
                        "b": 53
                    }
                }
            }
        ]
    }

The result in the PDF looks like this:

Textbox
fielddescriptiontypevalid valuesmandatory fieldstandard
x1
y1
x2
y2
coordinatesfloatyes
border.widthborder widthfloatno1
border.stylestring typestringsolid, dashed, dottedno1
border.color.r
border.color.g
border.color.b
Colors of the line as RGB value (red, green and blue)intno0, 0, 0
fill.color.r
fill.color.g
fill.color.b
fill colors as RGB value (red, green and blue)int no0, 0, 0
text.texttextstringno
text.fontcharacter setstringno
text.sizefont sizeintno
text.alignalignmentstringleft, center, rightnocenter
text.valignalignmentstringtop, middle, bottomnomiddle
text.color.r
text.color.g
text.color.b
colors of the text as RGB value (red, green and blue)intno0, 0, 0

Use the image type to insert an image into the PDF.

    {
        "objects": [
            {
                "type": "image",
                "url": "https://alvine.io/alvine.png",
                "x": 100,
                "y": 200
            }
        ]
    }

The result in the PDF looks like this:

Alvine Logo
fielddescriptiontypevalid valuesmandatory fieldstandard
urlURL of the imageurlyes
x
y
top left corner of the imagefloatyes
widthwidth of the imagefloatno
heightheight of the imagefloatno

With the type Line you can - as the name suggests - draw a line.

    {
        "objects": [
            {
                "type": "line",
                "x1": 100,
                "y1": 100,
                "x2": 200,
                "y2": 200,
                "color": {
                    "r": 0,
                    "g": 123,
                    "b": 145
                },
                "width": 3
            }
        ]
    }

The result in the PDF looks like this:

line
fielddescriptiontypevalid valuesmandatory fieldstandard
x1
y1
x2
y2
coordinatesfloatyes
widthline widthfloatno1
stylestring typestringsolid, dashed, dottedno1
color.r
color.g
color.b
colors of the line as RGB value (red, green and blue)intno0, 0, 0

The Oval type can be used to draw ovals and circles, as in the example. can be drawn with the corresponding coordinates.

    {
        "objects": [
            {
                "type": "oval",
                "x1": 10,
                "y1": 10,
                "x2": 90,
                "y2": 90,
                "border": {
                    "style": "dotted",
                    "color": {
                        "r": 94,
                        "g": 0,
                        "b": 53
                    }
                }
            }
        ]
    }

The result in the PDF looks like this:

Circles
fielddescriptiontypevalid valuesmandatory fieldstandard
x1
y1
x2
y2
coordinatesfloatyes
border.widthborder widthfloatno1
border.stylestring typestringsolid, dashed, dottedno1
border.color.r
border.color.g
border.color.b
Colors of the line as RGB value (red, green and blue)intno0, 0, 0

With the type polygon polygons can be can be drawn with the appropriate coordinates.

    {
        "objects": [
            {
                "type": "polygon",
                "border": {
                    "color": {
                        "r": 94,
                        "g": 0,
                        "b": 53
                    }
                },
                "fill": {
                    "color": {
                        "r": 200,
                        "g": 200,
                        "b": 200
                    }
                },
                "points": [
                    {
                        "x": 10,
                        "y": 30
                    },
                    {
                        "x": 285,
                        "y": 100
                    },
                    {
                        "x": 285,
                        "y": 150
                    }
                ]
            }
        ]
    }

The result in the PDF looks like this:

Polygon
fielddescriptiontypevalid valuesmandatory fieldstandard
points.x
points.y
X/Y coordinates of each point floatyes
border.widthborder widthfloatno1
border.stylestring typestringsolid, dashed, dottedno1
border.color.r
border.color.g
border.color.b
Colors of the line as RGB value (red, green and blue)intno0, 0, 0
fill.color.r
fill.color.g
fill.color.b
fill colors as RGB value (red, green and blue)intno0, 0, 0

With the template type, pages of PDF documents can be can be inserted into the current page with the appropriate coordinates and dimensions.

Note: Not all PDF documents and structures are supported.

            {
                "templates": [
                    {
                        "url": "https://cdn.alvine.io/examples/alvine-cloud-website.pdf",
                        "page": 1,
                        "name": "mytemplate",
                        "box": "/MediaBox"
                    }
                ]
            }
    {
        "objects": [
            {
                "type": "template",
                "name": "mytemplate",
                "x": 200,
                "y": 200,
                "width": 400,
                "height": 400
            }
        ]
    }

The result in the PDF looks like this:

pdf
fielddescriptiontypevalid valuesmandatory fieldstandard
namename of the template from the definitionstringyes
x
y
X/Y coordinates of the top left cornerfloatno0
0
width
height
width and height of the PDF to embedfloatnofrom the PDF

To ensure that no questions remain unanswered

We are there for you and offer you the perfect service. Benefit from our experience, innovative solutions and support that is geared to your needs alone. needs.

Our contact details & chat (german)

We look forward to seeing you.