ApryseSDK/webviewer-react-sample

Not able to open large file

twravindra opened this issue · 4 comments

I am trying to open large file upto 2 MB but WebViewer is not able to render the file.

File type: PPTX
Size: 1.8 MB

Current Behaviour: Large file not getting opened in rendrer.
Expected Behaviour: Should be able to open large file.

WebViewer should be able to handle files of that size without any issues. If you can share the document we can take a look. If it's a document you'd rather not share publicly then feel free to open a ticket https://apryse.com/support

The ppt file is base64 encoded
const file = useMemo(() => data:@file/ppt;base64,${doc.base64}, []);

WebViewer( { path: 'lib', licenseKey: key initialDoc: file, isReadOnly: true, accessibleMode: false, extension: 'ppt', }, viewer.current as HTMLDivElement, )

This is how i m using. For some reason, I can't use direct URL of file. That's why we are using base64 encoded string as of now.

P.S: It works with smaller base64 encoded.

@mparizeau-pdftron The issue also reproducible for bas64 of PDF file as well.

You can try this test PDF file: https://www.eurofound.europa.eu/sites/default/files/ef_publication/field_ef_document/ef1710en.pdf

You can use online tool to get base64 of file:
https://base64.guru/converter/encode/pdf

Now,

  1. Store base 64 in separate const file.
  2. Import that base64 const in below snippet.
    const file = useMemo(() => data:@file/pdf;base64,${doc.base64}, []);

I have stored it in using useMemo.

  1. Here is how my WebViewer object creation looks like:
    WebViewer( { path: 'lib', licenseKey: key initialDoc: file, isReadOnly: true, accessibleMode: false, extension: 'pdf', }, viewer.current as HTMLDivElement, )

I am getting blank page for this large file but it works for smaller file of size approx 600 KB.

P.S: We are using base64 directly not the URL of file.

Sorry for the delay in getting back to you. If you convert that base64 string into a blob like shown here does that make any difference for you?
https://docs.apryse.com/documentation/web/guides/basics/open/base64/