Embed Data Wizard into your web application using iFrames and interact with it programmatically using the JavaScript API.
Data Wizard is designed for seamless integration into existing web applications. The simplest and most user-friendly way to embed Data Wizard functionality is by using iFrames.
Embedding Data Wizard as an iFrame allows you to add data extraction capabilities to your web application with minimal development effort.
Steps to Embed Data Wizard using iFrames:
Generate a Pre-signed URL: For the Extractor you want to embed, go to the Extractor settings in the Data Wizard backend and find the “Embed” tab. Click the “Generate Embed URL” button. This will create a pre-signed URL that includes security parameters to authorize access to the embedded Data Wizard instance.
Copy the iFrame Code: Data Wizard will provide you with an iFrame HTML code snippet. Copy this code snippet. It will look similar to this:
Note: The src
attribute contains the pre-signed URL, which is unique for each Extractor and includes a security signature.
Embed the iFrame in Your Application: Paste the copied iFrame code snippet into the HTML code of your web application page where you want to embed the Data Wizard UI.
Customize iFrame (Optional): You can customize the appearance of the embedded Data Wizard UI using standard iFrame attributes like width
, height
, style
, class
, etc. You can also customize the UI further using CSS by setting the DATA_WIZARD_CSS_URL
environment variable in Data Wizard to point to your custom CSS file.
Example iFrame Embedding Code:
When embedding Data Wizard as an iFrame, a JavaScript API is available for communication between your host application and the embedded Data Wizard instance. This allows your application to:
Listening for iFrame Events:
Use the window.addEventListener('message', ...)
in your host application to listen for messages from the iFrame.
Example JavaScript Code to Receive iFrame Events:
Available iFrame Events:
screen.changed
: User navigated to a different screen in the embedded extractor.extraction.started
: Extraction process has begun.extraction.progress
: Real-time updates during extraction (data chunks as they are extracted).extraction.completed
: Extraction finished successfully. message.data.data
contains the final extracted data in JSON format.extraction.error
: An error occurred during extraction. message.data.error
contains error details.extraction.submitted
: User has submitted the final data after manual correction. message.data.data
contains the final (potentially corrected) data.You can customize the visual theme of the embedded iFrame to match your application’s design.
?theme=light
or ?theme=dark
to the iFrame src
URL to set the initial theme.set_theme
Message: Send a set_theme
message to the iFrame using wizardFrame.postMessage({ event: 'set_theme', theme: 'dark' }, '*')
to dynamically change the theme while the iFrame is open.DATA_WIZARD_CSS_URL
, ensure the CSS file is hosted securely and only contains safe CSS rules to prevent potential security risks.iFrame embedding provides a straightforward way to integrate Data Wizard’s data extraction capabilities into your web applications, offering both user-friendliness and programmatic control through the JavaScript API.
Next Steps
Step by step guide to extract data from documents using Data Wizard.
Learn how to define and configure data extraction tasks.
Understand different data processing strategies.
Set up your Large Language Model API keys.
Embed Data Wizard into other applications using iFrames or APIs.