-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying mupdf library directly with React #12
Comments
@ccxvii @mipo1357 Please note I create a simple React App starter for this, please see this branch: https://github.com/ArtifexSoftware/mupdf.js/tree/react-example . You can see the compile problem after an |
@ccxvii it could be that the solution here could work for us, requires further investigation: |
I got mupdf to work with react with the following approach. i import this in the index.html <script type="module" src="/mupdf-view.js"></script>
<script type="module" src="/mupdf-view-page.js"></script> import { MupdfDocumentViewer } from "../mupdf-view-page.js"
function Reader() {
useEffect(()=>{
new MupdfDocumentViewer(mupdfView)
},[])
return (
<div id="reader">
<div id="grid-sidebar">
<ul id="outline" />
</div>
<div id="grid-main" class="sidebarHidden">
<div id="pages" />
<div ref={placeholder} id="placeholder">
<div>Loading WASM, please wait...</div>
</div>
</div>
<div
id="search-dialog"
class="dialog"
style="display: none"
/>
<input
type="file"
id="open-file-input"
style="display: none"
accept=".pdf,.xps,application/pdf"
onChange={(e) => {
documentViewer.openFile(e.target.files[0])
}}
/>
)
} |
With this setup we can run a React-based app via a node server, so basically a REST API provided by the node server to the react client.
However, if we just want to run a React-based app directly upon the MuPDF library, i.e.:
It fails to compile with:
Could there be some further environmental setup that the wasm library needs to understand?
The text was updated successfully, but these errors were encountered: