snaphtml
Reactive icon

SnapHTML

Stable version 1.0.0 (Compatible with OutSystems 11)
Uploaded
 on 26 Jul (4 days ago)
 by 
0.0
 (0 ratings)
snaphtml

SnapHTML

Documentation
1.0.0

 SnapHTML – HTML to Image Converter

SnapHTML is a utility library built in OutSystems to convert HTML content into downloadable images or Base64 strings using the html2canvas JavaScript library.

It provides easy-to-use client actions to:

  • Capture DOM elements or HTML strings as images

  • Output as PNG, JPEG, or WebP

  • Choose resolution (scale) and background color

  • Either download the image or return it as Base64

    Client Actions Overview

    Action NameDescription
    CaptureElementToImageDownloadCaptures an element by ID and downloads the image
    CaptureHtmlToImageDownloadRenders provided HTML string and downloads the image
    CaptureElementToBase64Captures an element by ID and returns the image as Base64
    CaptureHtmlToBase64Renders HTML string and returns the image as Base64


    Input Parameters
    ParameterTypeRequiredDescriptionExample / Allowed Values
    ElementIDText✅ (Element-based)ID of the HTML element to capture (use in CaptureElement... actions)"myWidget"
    HtmlStringText✅ (HTML-based)Valid HTML string to render and capture (used in CaptureHtml... actions)"<div>Hello</div>"
    FormatTextImage format to generate"png" (default), "jpeg", "webp"
    ScaleDecimalZoom level for image rendering. Controls resolution.1.0 to 10.0 (default: 2)
    BackgroundColorTextBackground fill color for image. Must be a valid CSS color string."#ffffff", "transparent"
    FileNameTextFile name used when downloading image (no extension needed)"my-capture"

    Output Parameters
    Action NameOutput ParameterTypeDescription
    CaptureElementToBase64ImageBase64TextBase64 representation of the captured image
    CaptureHtmlToBase64ImageBase64TextBase64 representation of the rendered HTML
    All ActionsErrorTextEmpty if success; otherwise contains message

    Library Dependency
    Ensure the wb_html2canvasLib web block is added to your screen or layout where these actions are used. This loads the html2canvas JavaScript library required for rendering.


  • The html2canvas library is distributed under the:

    MIT License (Massachusetts Institute of Technology)


    What This License Allows:

    • Commercial use – You can use html2canvas in commercial applications (e.g., OutSystems apps)