Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Not able to open large file #24

Open
twravindra opened this issue Jul 28, 2023 · 4 comments
Open

Not able to open large file #24

twravindra opened this issue Jul 28, 2023 · 4 comments

Comments

@twravindra
Copy link

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.

@mparizeau-pdftron
Copy link
Contributor

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

@twravindra
Copy link
Author

twravindra commented Jul 31, 2023

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.

@twravindra
Copy link
Author

@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.

@mparizeau-pdftron
Copy link
Contributor

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/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants