Class ScreenshotSink
- Namespace
- Datafication.Sinks.Connectors.WebConnector
- Assembly
- Datafication.WebConnector.dll
Transforms a DataBlock into a screenshot image by rendering it as an HTML table.
public class ScreenshotSink : IDataSink<byte[]>
- Inheritance
-
objectScreenshotSink
- Implements
-
IDataSink<byte[]>
Remarks
This sink uses Puppeteer to render the DataBlock as an HTML table and capture it as a PNG or JPEG image. Useful for generating visual reports or previews.
Properties
BackgroundColor
Gets or sets the background color. Default is white.
public string BackgroundColor { get; set; }
Property Value
- string
CustomCss
Gets or sets custom CSS to apply to the rendered page.
public string? CustomCss { get; set; }
Property Value
- string
DeviceScaleFactor
Gets or sets the device scale factor for high DPI. Default is 1.
public double DeviceScaleFactor { get; set; }
Property Value
- double
Format
Gets or sets the image format. Default is PNG.
public ScreenshotFormat Format { get; set; }
Property Value
FullPage
Gets or sets whether to capture full page or just viewport. Default is true.
public bool FullPage { get; set; }
Property Value
- bool
HeaderBackgroundColor
Gets or sets the table header background color.
public string HeaderBackgroundColor { get; set; }
Property Value
- string
HeaderTextColor
Gets or sets the table header text color.
public string HeaderTextColor { get; set; }
Property Value
- string
Quality
Gets or sets the JPEG quality (1-100). Only used when Format is Jpeg.
public int? Quality { get; set; }
Property Value
- int?
RowLimit
Gets or sets the row limit for the table. Default is 100.
public int RowLimit { get; set; }
Property Value
- int
Subtitle
Gets or sets optional subtitle to display below the title.
public string? Subtitle { get; set; }
Property Value
- string
Title
Gets or sets optional title to display above the table.
public string? Title { get; set; }
Property Value
- string
UseAlternateRowColor
Gets or sets whether to use alternating row colors. Default is true.
public bool UseAlternateRowColor { get; set; }
Property Value
- bool
ViewportWidth
Gets or sets the viewport width. Default is 1200.
public int ViewportWidth { get; set; }
Property Value
- int
Methods
Transform(DataBlock)
Transforms the DataBlock into a screenshot image.
public Task<byte[]> Transform(DataBlock dataBlock)
Parameters
dataBlockDataBlockThe DataBlock to transform.
Returns
- Task<byte[]>
A byte array containing the image data.