Skip to main content

Previewing data Pro / Enterprise

Kreya previews allow you to programmatically create powerful data visualizations directly within Kreya. By adding preview calls to your scripts, you can turn raw response data into meaningful visual displays.

Why use previews?

  • Enhanced data interpretation: Visualize raw response data in a more digestible format, making it easier to understand.
  • Customizable visualizations: Tailor the preview to highlight the most relevant details for your use case.

How previews work

Kreya's kreya.preview API provides methods to display various types of data in the preview tab. For example, you can render PDFs and HTML from in-memory data or preview files from the file system.

Example: Displaying a PDF

The following script demonstrates how to display a PDF document in Kreya's preview tab:

// preview a pdf file from the file system
await kreya.preview.file('./sample.pdf', 'Sample PDF');

// preview a pdf document based on in-memory data
const pdfData = new Uint8Array([
/* ... */
]);
await krey.preview.pdf(pdfData, 'Sample PDF');

This will render the sample.pdf file or the provided data in the preview tab with the title "Sample PDF".

Explore the API

To learn more about the kreya.preview API and its capabilities, check out the kreya.preview API documentation.

Samples

Explore the samples to see Kreya's preview capabilities in action.