Comments (9)
I think what @Relaxe111 is asking for is support to render file blobs as seen here in
react-pdf
https://react-pdf.org/advanced#on-the-fly-rendering. I'm not sure how you would support this across the multiple file type plugins.
I will look into this, I feel like if it can't do it right now, it shouldn't take much effort to make it work.
from react-doc-viewer.
I guess it depends on how you have loaded the file.
If you have file at coding you can require('filename.png').
If you have base64 I believe that you can pass it to file data instead of providing a Uri to the document object.
https://github.com/Alcumus/react-doc-viewer#idocument
I haven't tried this, so you will have to see if it works.
You may have to use a custom file loader https://github.com/Alcumus/react-doc-viewer#custom-file-loader
from react-doc-viewer.
I think what @Relaxe111 is asking for is support to render file blobs as seen here in react-pdf
https://react-pdf.org/advanced#on-the-fly-rendering. I'm not sure how you would support this across the multiple file type plugins.
from react-doc-viewer.
oh sorry didn't received MSG (. Yes I am asking if is possible support for render file blobs )
from react-doc-viewer.
Hi @mattmogford-alcumus I'm would also like to embed blob urls as files. Any update on this feature request?
from react-doc-viewer.
Looks like this is going to be a feature soon? Anybody come up with a workaround in the meantime?
from react-doc-viewer.
Passing the fileData and fileType seems to not overwrite the request to the uri - and when that loads, it overwrites the fileData 😕
What eventually worked for me was using a custom renderer and loader. Would have prefered to use the loader only with the default renderers, but this is fine too.
The documentation is a good starting point, but I think what is missing from the example is that fileLoaderComplete function wants a fileReader as a prop:
MyCustomPNGRenderer.fileLoader = ({
documentURI,
signal,
fileLoaderComplete,
}) => {
myCustomFileLoaderCode().then(() => {
// Whenever you have finished you must call fileLoaderComplete() to remove the loading animation
const fileReader = new FileReader();
fileReader.addEventListener('loadend', () => {
fileLoaderComplete(fileReader);
})
// example of file loaded as blob with axios.
const response = await axios.get('https://placekitten.com/200/300', {
responseType: 'blob',
});
fileReader.readAsDataUrl(response.data);
});
};
Should work with other sort of blobs, not just axios loaded ones. I just used axios because I needed to pass in an authorization token in the request header.
from react-doc-viewer.
please any update with regards to the open question?
from react-doc-viewer.
@mattmogford, @mattmogford-alcumus : I have a url of type blob:https://site.com/dce5e4da-0a44-4aa7-8c33-941af8cbcc93
, there is news about this function, it is very important to me it is only way I have.
from react-doc-viewer.
Related Issues (20)
- Error: Invalid hook call. Hooks can only be called inside of the body of a function component. HOT 3
- local files not rendering HOT 2
- For PDF Files, set a default Zoom level
- DOMException: The user aborted a request. HOT 1
- how to add custom zoom ?
- Support for AWS.storage.geturl() HOT 1
- XLSX, DOCX, PPTX not working HOT 1
- Docx, Doc file is not working i am passing base64data URI
- Doc viewer buttons submit form
- pdfjs-dist-2.4.456.tgz: 1 vulnerabilities (highest severity is: 8.8) - autoclosed HOT 1
- react-pdf-5.0.0.tgz: 2 vulnerabilities (highest severity is: 8.8) - autoclosed HOT 1
- react-pdf-8.0.2.tgz: 1 vulnerabilities (highest severity is: 8.8) - autoclosed HOT 1
- License Policy Violation detected in picocolors-1.0.1.tgz - autoclosed HOT 1
- Dependency Dashboard
- Conent is repeating without styling
- Not working with Next JS version (0.1.11) HOT 2
- API "3.11.174" and Worker "4.2.67" Version Mismatch HOT 7
- ERR_REQUIRE_ESM error while the package is trying to import the pdf.worker.min.js
- pdfjs的cMapUrl问题该如何解决?
- Unable to resolve path to module
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-doc-viewer.