Instant Doc Viewer
Overview
The Instant Doc Viewer widget is a versatile file viewer designed for seamless integration into Mendix applications. It allows users to preview and render various file types, including images, PDFs, Excel sheets, and Word documents, directly within the application without requiring external downloads.
Key Features:
- Multi-File Support: View .docx, .xlsx, .pdf, .png, .jpg, and more.
- In-App File Rendering: Displays documents and spreadsheets in a clean, responsive interface.
- Excel to PDF Conversion: Converts Excel files into PDF format for consistent rendering.
- Word Document Parsing: Handles paragraphs, images, and tables while preserving content sequence.
- Optimized for Performance: Leverages modern libraries for smooth document processing.
- Customizable Layout: Adjustable width and height for embedding in various page designs.
This widget is ideal for scenarios where quick document previewing is essential, such as dashboards, user portals, or file management systems.
Documentation
Typical usage scenario
The Instant Doc Viewer widget is ideal for applications where users need to preview files quickly without downloading them. It is perfect for document management systems, employee or customer portals, and workflow automation, enabling seamless viewing of files like Word documents, Excel sheets, PDFs, and images directly within the app. This widget enhances productivity and simplifies file handling in dashboards, educational platforms, and administrative tools.
Features and limitations
Features
- Multi-File Support: View .docx, .xlsx, .pdf, .png, and .jpg files directly in the app.
- Excel to PDF Conversion: Converts Excel files into PDF format for consistent rendering.
- Word Document Parsing: Preserves the sequence of paragraphs, images, and tables in .docx files.
- Responsive Design: Adjustable width and height for seamless integration into any layout.
- In-App File Rendering: Eliminates the need for external viewers by displaying files within the application
Limitations
- Advanced Formatting: May not fully support complex .docx formatting, such as custom fonts or nested tables.
- File Size Limitations: Files larger than [X MB] may cause slower rendering.
- Unsupported File Types: Does not currently support .pptx or audio files.
Dependencies
To successfully integrate and use the Instant Doc Viewer widget in your Mendix applications, ensure the following dependencies are installed:
-
External Libraries (Bundled in the widget):
- jsPDF: For PDF creation and rendering.
- XLSX (SheetJS): For reading and processing Excel files.
- docx,mammoth: For parsing and handling .docx files.
-
Mendix Requirements:
- Mendix Version: Compatible with Mendix 9.x or higher.
- File Entity: The widget requires a file entity generalized from System.FileDocument to store and fetch files.
ConfigurationĀ
Follow these steps to configure the Instant Doc Viewer widget in your Mendix application:
-
Add the Widget to Your Page:
- Drag and drop the Instant Doc Viewer widget from the toolbox onto your desired page.
-
Set the Data Source:
- Bind the widget's Data Source property to an entity generalized from System.FileDocument.
-
Configure File Properties:
- Map the File Name attribute to the file name in your data model.
- Set optional properties like Width and Height to define the widget's dimensions.
-
Testing:
- Upload files (e.g., .docx, .xlsx, .pdf, .png, or .jpg) to the bound entity.
- Open the page and ensure the files render correctly within the widget.
-
Optional:
- Adjust CSS styles in the FileViewer.css file for further customization.
That's it! Your Instant Doc Viewer widget is ready for use.