Loading...

Generate PDF Using Templates

Note: You need to create a template in the console to use this API.

Description

You can use this API to generate PDF documents of webpages using Templates as your input.

PDF Request Details

Request URL

POST

{api-domain}/browser360/v1/project/{project_id}/convert

copy

api-domain
URL
The DC-specific domain to access Catalyst API

project_id
Numerical
The unique ID of the project

Scope

ZohoCatalyst.pdfshot.EXECUTE

Request JSON Properties

display_header_footer boolean
optional
Pass the value as true to show the header and footer.
Default: false.
format PaperFormat
optional
Size of the paper. Example: A4, A3.
landscape boolean
optional
Pass the value as true to print in landscape orientation.
password string
optional
Pass the password value of the PDF document.
omit_background boolean
optional
Hides the default white background and allows generating PDFs with a transparent background.
page_ranges string
optional
Paper ranges to print. Example: 1-5, 8, 11-13.
prefer_css_pageSize boolean
optional
Pass the value as true to prioritize the CSS @page size declared in the page over what is declared in the width, height, or format option
print_background boolean
optional
Pass the value as true to print the background graphics
scale number
optional
Scales the rendering of the web page. Acceptable Values: Between 0.1 and 2.
timeout number
optional
Timeout in milliseconds. Pass the value as 0 to disable the timeout.
width string | number
optional
Sets the width of paper. You can pass in a number or a string with a unit.
timeout number
optional
Maximum wait time in milliseconds. Pass the value as 0 to disable the timeout.

The default value can be changed by using the
page.set_default_timeout() or page.set_default_navigation_timeout() methods.
wait_until string | number
optional
password string
optional
Will hold the value of the password that protects your PDF document.

PDF Response Details

The response will be a PDF that was generated.

Note:

  • You need to create a template in the console to use this API.

  • SmartBrowz Templates offers you the option to set a password for the PDF document you generate using a template. If you employ the Set Password Manually option, then you can use this API. This API cannot be used if you employ the Set Password Dynamically option.

Generate Screenshot Using Templates

Screenshot Description

You can use this API to generate screenshot of webpages, by using Templates as your input.

Screenshot Request Details

Request URL

POST

{api-domain}/browser360/v1/project/{project_id}/convert

copy

project_id
Numerical
The unique ID of the project

Scope

ZohoCatalyst.pdfshot.EXECUTE

Request JSON Properties

capture_beyond_viewport boolean
mandatory
Pass the value as true to capture the screenshot beyond the viewport
clip screenshot_clip
mandatory
Object that specifies the clipping region of the page
encoding 'base64' | 'binary'
mandatory
Encoding of the image
from_surface boolean
mandatory
Pass the value as true to capture the screenshot from the surface, rather than the view
full_page boolean
mandatory
Pass the value as true to take a screenshot of the entire page
omit_background boolean
mandatory
Hides the default white background and allows capturing screenshots with a transparent background
quality number
optional
Maximum wait time in milliseconds. Pass the value as 0 to disable the timeout.

The default value can be changed by using the
page.set_default_timeout() or page.set_default_navigation_timeout() methods.
wait_until string | number
optional

Screenshot Response Details

The response will be a Screenshot that was generated.

Note: Any Browser action or operation that you code using the Browser Logic function, or any browser automation or web scraping task that you perform using any component of Catalyst SmartBrowz is at your own risk. We strongly recommend you use the SmartBrowz components to perform operations on domains that permit the actions, or with proper approval. Additionally, while Catalyst does provide a secure infrastructure to code your functions, any consequence of the logic you code using Catalyst functions is yours alone.
CURL Request - PDF from Templates
copy

curl -X POST 'https://api.catalyst.zoho.com/browser360/v1/project/10470000000272001/convert' -H “Authorization: Zoho-oauthtoken 1000.910*************************16.2f*************************57”
-H ‘Content-Type: application/json’ –d ‘{ “template_id”:“367000000044001”, “template_data”:{}, “output_options”: { “output_type”: “pdf” }, “pdf_options” : { “scale” : 1, “display_header_footer” : true,

    "print_background" : false,
    "landscape" : false,
    "page_ranges" : "1",
    "format" : "A4",
    "width" : "100",
    "height" : "100",
    "omit_background" :  false,
    "password": "Demo$"
},
"page_options":{
    "css" : {
        "content" : "body{background: lightgrey}"
    },
    "viewport" : {
        "width": 1440,
        "height": 900
    },
    "javascript_enabled" : true
},
"navigation_options":{
    "timeout" : 5000,
    "wait_until" : "networkidle0"
}

}’

View more
CURL Request - Screenshot from Templates
copy

curl -X POST \ ‘https://api.catalyst.zoho.com/browser360/v1/project/10470000000272001/convert' -H “Authorization: Zoho-oauthtoken 1000.910*************************16.2f*************************57”
-H ‘Content-Type: application/json’ -d ‘{ “template_id”:“367000000044001”, “template_data”:{}, “output_options”: { “output_type”: “pdf” }, “screenshot_options” : { “type” : “jpeg”, “quality” : 100, “full_page” : false, “omit_background” : false, “capture_beyond_viewport” : true, “clip” :{ “x” : 50, “y” : 100, “width” : 1000, “height”: 100 } }, “page_options”:{ "css" : { "content" : "body{background: lightgrey}" }, "viewport" : { "width": 1440, "height": 900 }, "javascript_enabled" : true }, “navigation_options”:{ “timeout” : 5000, “wait_until” : “networkidle0” } }’

View more