Generate PDF with URL as SourceAdmin Scope

Notes:
  • Ensure you have installed the required package to use this SDK method.

  • 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 that 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.

Pass the required URL to the convertToPdf() SDK method to generate a visual document of the corresponding webpage.

The smartbrowz reference used in the code snippets below is the component instance created to perform these operations.

copy
const result = await smartbrowz.convertToPdf("https://www.google.com", {
  pdf_options: {
    display_header_footer: true,
    footer_template: "Page Header",
    margin: {
      bottom: "20",
      left: "10",
      right: "10",
      top: "20"
    },
    height: "100",
    width: "100",
    landscape: true,
    page_ranges: "1-2",
    scale: 1.0,
    password: "*****123"
  },
  page_options: {
    css: { content: "body { font-size: 12px; }" },
    javascript_enabled: true,
    viewport: {
      height: 800,
      width: 600
    },
    device: "Blackberry PlayBook"
  },
  navigation_options: {
    timeout: 30000,
    wait_until: "domcontentloaded"
  }
});
console.log("result::", result);

Last Updated 2026-07-02 14:51:41 +0530 IST