Hi,
How can I improve the performance when opening large binary files (like PDFs or Word docs) using the Preview Document component from Forge in OutSystems?I'm currently facing delays when previewing large files. Are there any best practices, lazy loading techniques, or streaming options to optimize the load time and user experience?
Hi @SreenivasuluReddy Lingala ,
You're right - when using the Preview Document component from Forge to open large binary files (e.g., PDFs, Word documents), performance issues like delayed loading are common. Below are some best practices and optimizations to help improve performance and user experience :
1. Use Binary Caching (Avoid Fetching from DB Every Time)
2. Use Direct URL Instead of Binary Transfer (if possible)
3. Use Lazy Loading or Conditional Rendering
4. Limit the File Size or Compress PDFs
5. Use Pagination or Partial Previews (Custom Approach)
Best Regards,
Sumit
Along with above best practices, the approach you can follow is:
Convert word to PDF and store externally like S3/Azure.
You can stream via signed URL into a PDF.js viewer and enable lazy loading.
You may find my article on that topic helpful https://medium.com/itnext/serve-files-at-scale-with-outsystems-and-aws-s3-and-cloudfront-6f0b11a37866Just like Mandar above already implied you will not be able to improve the loading performance with built in mechanisms. Though PDF supports streamed loading (with optimized, so called linearized documents) OutSystems itself is capable of streaming content.
Note that the viewer you are using must be able to support streamed displaying as well. I don't know this one, but e.g. pdfJS Viewer supports that or Adobe PDF Embed. For both you will find components on Forge.
Stefan