PDF & Screenshot

Catalyst SmartBrowz offers you the PDF & Screenshot component to generate your prefered visual docuemnts through code. You can incorporate this functionality in your application by copying the code below and pasting it in your application logic.

Using the SDK below, you can generate visual documents by using HTML, URL or Templates as your input.

Generate Visual Documents Using Template

    
copy
const smartbrowz = app.smartbrowz(); let result = await smartbrowz.generateFromTemplate("YOUR_TEMPLATE_ID", { "template_data": YOUR_TEMPLATE_DATA, "output_options":{ "output_type": "screenshot" } }); console.log(result); // Generated PDF or screenshot is in the form of buffer

Generate PDF From HTML

    
copy
const smartbrowz = app.smartbrowz(); let result = await smartbrowz.convertToPdf("YOUR_HTML_CODE", { "pdf_options": {}, "page_options": {} }); console.log(result); // Generated pdf is in the form of buffer

Generate Screenshot from URL

    
copy
const smartbrowz = app.smartbrowz(); let result = await smartbrowz.takeScreenshot("YOUR_URL", { "screenshot_options": { "type": "jpeg" }, "page_options": { "device": "iPad" } }); console.log(result); // Captured screenshot is in the form of buffer

In the PDF & Screenshot section of the console, you can directly test this component using the Playground feature, and you can also copy the SDK directly from the console.

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.

Last Updated 2024-01-31 12:43:52 +0530 +0530