Generate a multi page PDF
How to generate asynchronously a multi page PDF - Abyssale REST API
This feature is available from the Prime plan.
Prerequisites:
Obtain a PDF multi page from the Rest API:
1. Using a Print format in your template
Using one of the available Print format & then choosing the "Print Multi-page" Type will enable the PDF type by default when generating that format.
Generate a PDF
A multi page PDF is created by sending data and customisation parameters to the POST
/banner-builder/{templateId}/generate
endpoint, which will respond asynchronously with a payload containing the URL of the generated PDF.
Supported template type: Static
Generation response type: Synchronous
Properties available for each type of component are available here.
Get the default payload
To ease the creation of your payload, just go to one of your Template
and choose Abyssale Rest API
in the Generation Methods list. You will find the default associated payload in the console (Feel free to remove unnecessary properties/elements):
Sample request
Do not forget to replace {YOUR-API-KEY}
and {templateId}
curl -X POST -H "x-api-key:{YOUR-API-KEY}" -H "Content-Type: application/json" \
-d '{
"image_file_type": "pdf",
"pages": {
"page_1": {
"root": {
"background_color": "cmyka(0,0,0,0,100)"
},
"tb-image_0": {
"image_url": "https://production-banners.s3-eu-west-1.amazonaws.com/templates/v2/e0d292f2-ec21-11e9-a539-3c408bf94155/4a2e214c-cb04-4388-bd59-bb93b03abe15/v2_66bcfed3-792f-44b5-a4d6-bd9ecd5806e9.jpeg",
"fitting_type": "fill",
"alignment": "middle center",
"filter_name": "duotone",
"filter_properties": {
"name": "blue_orange"
},
"hidden": false
},
"tb-text_0": {
"payload": "Aby Mag",
"color": "cmyka(0,0,0,100,100)",
"font_size": 48,
"font": "fe4efd78-d939-401d-bf6a-13ec65ba2558",
"font_weight": 400,
"line_height": 130,
"skew_y": -11,
"alignment": "middle left",
"hidden": false
}
},
"page_2": {
"root": {
"background_color": "cmyka(0,0,0,0,100)"
},
"tb-image_0": {
"image_url": "https://production-banners.s3-eu-west-1.amazonaws.com/templates/v2/e0d292f2-ec21-11e9-a539-3c408bf94155/4a2e214c-cb04-4388-bd59-bb93b03abe15/v2_6a887b92-9d46-4dca-a6d9-ed3648918c39.jpeg",
"fitting_type": "cover",
"alignment": "bottom right",
"mask_name": "blob",
"hidden": false
},
"tb-text_0": {
"payload": "Health",
"color": "cmyka(0,0,0,100,100)",
"font_size": 48,
"font": "6156629c-33c5-11ea-9877-92672c1b8195",
"font_weight": 400,
"line_height": 130,
"alignment": "top left",
"hidden": false
},
"tb-text_1": {
"payload": "Le Lorem Ipsum...",
"color": "cmyka(0,0,0,100,100)",
"font_size": 18,
"font": "6156629c-33c5-11ea-9877-92672c1b8195",
"font_weight": 400,
"line_height": 130,
"alignment": "top left",
"hidden": false
}
}
}' \
https://api.abyssale.com/banner-builder/{templateId}/generate
const axios = require('axios');
const payload = {
"image_file_type": "pdf",
"pages": {
"page_1": {
"root": {
"background_color": "cmyka(0,0,0,0,100)"
},
"tb-image_0": {
"image_url": "https://production-banners.s3-eu-west-1.amazonaws.com/templates/v2/e0d292f2-ec21-11e9-a539-3c408bf94155/4a2e214c-cb04-4388-bd59-bb93b03abe15/v2_66bcfed3-792f-44b5-a4d6-bd9ecd5806e9.jpeg",
"fitting_type": "fill",
"alignment": "middle center",
"filter_name": "duotone",
"filter_properties": {
"name": "blue_orange"
},
"hidden": false
},
"tb-text_0": {
"payload": "Aby Mag",
"color": "cmyka(0,0,0,100,100)",
"font_size": 48,
"font": "fe4efd78-d939-401d-bf6a-13ec65ba2558",
"font_weight": 400,
"line_height": 130,
"skew_y": -11,
"alignment": "middle left",
"hidden": false
}
},
"page_2": {
"root": {
"background_color": "cmyka(0,0,0,0,100)"
},
"tb-image_0": {
"image_url": "https://production-banners.s3-eu-west-1.amazonaws.com/templates/v2/e0d292f2-ec21-11e9-a539-3c408bf94155/4a2e214c-cb04-4388-bd59-bb93b03abe15/v2_6a887b92-9d46-4dca-a6d9-ed3648918c39.jpeg",
"fitting_type": "cover",
"alignment": "bottom right",
"mask_name": "blob",
"hidden": false
},
"tb-text_0": {
"payload": "Health",
"color": "cmyka(0,0,0,100,100)",
"font_size": 48,
"font": "6156629c-33c5-11ea-9877-92672c1b8195",
"font_weight": 400,
"line_height": 130,
"alignment": "top left",
"hidden": false
},
"tb-text_1": {
"payload": "Le Lorem Ipsum...",
"color": "cmyka(0,0,0,100,100)",
"font_size": 18,
"font": "6156629c-33c5-11ea-9877-92672c1b8195",
"font_weight": 400,
"line_height": 130,
"alignment": "top left",
"hidden": false
}
}
}
axios.post("https://api.abyssale.com/banner-builder/{templateId}/generate", payload, {
headers: {"x-api-key": "{YOUR-API-KEY}", "Content-Type": "application/json", "timeout": 30000}
}).then(response => {
console.log(response.data)
})
import json
import requests
image_generation_payload = {
"image_file_type": "pdf",
"pages": {
"page_1": {
"root": {
"background_color": "cmyka(0,0,0,0,100)"
},
"tb-image_0": {
"image_url": "https://production-banners.s3-eu-west-1.amazonaws.com/templates/v2/e0d292f2-ec21-11e9-a539-3c408bf94155/4a2e214c-cb04-4388-bd59-bb93b03abe15/v2_66bcfed3-792f-44b5-a4d6-bd9ecd5806e9.jpeg",
"fitting_type": "fill",
"alignment": "middle center",
"filter_name": "duotone",
"filter_properties": {
"name": "blue_orange"
},
"hidden": false
},
"tb-text_0": {
"payload": "Aby Mag",
"color": "cmyka(0,0,0,100,100)",
"font_size": 48,
"font": "fe4efd78-d939-401d-bf6a-13ec65ba2558",
"font_weight": 400,
"line_height": 130,
"skew_y": -11,
"alignment": "middle left",
"hidden": false
}
},
"page_2": {
"root": {
"background_color": "cmyka(0,0,0,0,100)"
},
"tb-image_0": {
"image_url": "https://production-banners.s3-eu-west-1.amazonaws.com/templates/v2/e0d292f2-ec21-11e9-a539-3c408bf94155/4a2e214c-cb04-4388-bd59-bb93b03abe15/v2_6a887b92-9d46-4dca-a6d9-ed3648918c39.jpeg",
"fitting_type": "cover",
"alignment": "bottom right",
"mask_name": "blob",
"hidden": false
},
"tb-text_0": {
"payload": "Health",
"color": "cmyka(0,0,0,100,100)",
"font_size": 48,
"font": "6156629c-33c5-11ea-9877-92672c1b8195",
"font_weight": 400,
"line_height": 130,
"alignment": "top left",
"hidden": false
},
"tb-text_1": {
"payload": "Le Lorem Ipsum...",
"color": "cmyka(0,0,0,100,100)",
"font_size": 18,
"font": "6156629c-33c5-11ea-9877-92672c1b8195",
"font_weight": 400,
"line_height": 130,
"alignment": "top left",
"hidden": false
}
}
}
r = requests.post("https://api.abyssale.com/banner-builder/{templateId}/generate",
headers={"x-api-key": "YOUR-API-KEY", "Content-Type": "application/json"},
data=json.dumps(image_generation_payload),
timeout=30
)
r.json()
Sample response
{
"generation_request_id": "67b7ad0f-ebb6-4535-8ef2-5bd7bdde8ac5",
"banners": [
{
"id": "5f9dedbf-0176-48a2-a204-47ec9fff9014",
"image": {
"type": "pdf",
"url": "https://production-banners.s3-eu-west-1.amazonaws.com/e0d292f2-ec21-11e9-a539-3c408bf94155/5f9dedbf-0176-48a2-a204-47ec9fff9014.pdf",
"cdn_url": "https://cdn.abyssale.com/e0d292f2-ec21-11e9-a539-3c408bf94155/5f9dedbf-0176-48a2-a204-47ec9fff9014.pdf"
},
"format": { "width": 5.5, "height": 8.5, "unit": "in" },
"template": { "id": "4a2e214c-cb04-4388-bd59-bb93b03abe15", "name": "untitled", "created_at": 1715775978, "updated_at": 1715865885 },
"file": {
"type": "pdf",
"url": "https://production-banners.s3-eu-west-1.amazonaws.com/e0d292f2-ec21-11e9-a539-3c408bf94155/5f9dedbf-0176-48a2-a204-47ec9fff9014.pdf",
"filename": "5f9dedbf-0176-48a2-a204-47ec9fff9014.pdf",
"cdn_url": "https://cdn.abyssale.com/e0d292f2-ec21-11e9-a539-3c408bf94155/5f9dedbf-0176-48a2-a204-47ec9fff9014.pdf"
}
}
],
"errors": []
}
Errors
The Abyssale Pdf Generation API can return the following error codes :
Last updated