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.

Last Updated 2023-10-19 16:35:41 +0530 +0530