Read DOCx and PDF from stream

Does the FNX WX Pack allow you to view documents (PDF or DOCx) stored in a TMemoryStream?

Hi,

A stream won't be sent over the bridge, the data needs to be in string format for that. However, you can convert your stream to base64 and load from there:

TMSFNCWXPDFViewer1.LoadFromBase64(TTMSFNCUtils.SaveStreamToBase64(pdfstream));
TMSFNCWXDocXViewer1.LoadFromBase64(TTMSFNCUtils.SaveStreamToBase64(docxstream));

Thank you.

It worked, but I can't load the PDF in the OnShow event.

I had to include a 1 second timer and in the OnTimer event put the TMSFNCXPDFViewer1.LoadFromBase64(...)

It seems that the Viewer can only display the PDF if it is being viewed in the form. Is that correct?

If you mean the form's OnShow event then it is expected. The embedded browser goes through an initialization process which is not complete by the time OnShow triggers, and interacting with the control via methods and properties during initialization will stop the loading.
A safer approach than a timer would be to use the TTMSFNCWXPDFViewer.OnViewerInitialized event which is triggered when the embedded browser is initialized and the control is ready to be interacted with.

Yes. Frames are not supported.