Skip to content
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

Compile PDF file #5

Closed
zjkmxy opened this issue Nov 14, 2023 · 9 comments · Fixed by #28
Closed

Compile PDF file #5

zjkmxy opened this issue Nov 14, 2023 · 9 comments · Fixed by #28
Assignees

Comments

@zjkmxy
Copy link
Collaborator

zjkmxy commented Nov 14, 2023

https://github.com/zjkmxy/ndn-workspace-solid/blob/3e46cb7757ff9fcdaeabd339c16a4212d175e01a/src/components/share-latex/share-latex.tsx#L169-L182

Current implementation tries to push a ZIP file to localhost's 6175 port, which is supposed to be running a LaTeX server.
We need a better design for this.

Note: the LaTeX server's code is not published. Please let me know if you need to access it.

Idea: There are two ways. Need discussion.

  • Use RICE like discovery protocol, so the LaTeX server does not need to join the Sync group.
  • Let the LaTeX server to join the sync group.
@yoursunny
Copy link

Is it possible to compile the LaTeX server to WebAssembly, and then run it as WebWorker?

@zjkmxy
Copy link
Collaborator Author

zjkmxy commented Nov 15, 2023

Is it possible to compile the LaTeX server to WebAssembly, and then run it as WebWorker?

Yes. We have discussed this idea from beginning: https://github.com/SwiftLaTeX/SwiftLaTeX
The pros:

  • Works for tablets and phones.
  • Can work offline.

The cons:

  • The only existing LaTeX in WASM uses AGPL license, which may affect the deployment.
  • If we ship LaTeX, we need to also ship those common libraries, fonts, etc. But there are too many of them.

Therefore, we think we should try other methods first.

@pulsejet
Copy link
Member

pulsejet commented Nov 15, 2023

Ah I missed this. So I tweaked the implementation in #28 and the compilation speeds are really impressive (few hundred ms for recompilation). The initial compile times take a bit of time but my guess is that has partly to do with the package service. I believe it also already works with usepackage (see screenshot) and pulls libraries on demand (albeit from their server, though this should be possible to eventually fix)

I'm encouranged to push for this direction in favor of truly local-first software. Plus it seems like a nice way to show "completeness" in our retreat demo (BTW the header for bootstrapping says "Hackathon" I think we'll probably test this during retreat?)

Also we can sidestep AGPL restrictions by keeping all compiler code strictly separated (easy enough) and make it possible to build it as an optional module, similar to what ffmpeg does. Anyway, I'm actually in favor of AGPL (I don't want/see anyone commercializing any part of this) but that's not my call of course.

image

@zjkmxy
Copy link
Collaborator Author

zjkmxy commented Nov 15, 2023

Thank you for your hard work!
Yes. We will demo this in the retreat, and then consider wrapping a hackathon project.

We can separate the compiler as a downloadable module. I'm not sure about the limitation of AGPL.

@pulsejet
Copy link
Member

Ok, great. How do you suggest to proceed? Can you review the draft PR? Actually I don't think I can make it much cleaner than it is.

@zjkmxy
Copy link
Collaborator Author

zjkmxy commented Nov 15, 2023

Ok, great. How do you suggest to proceed? Can you review the draft PR? Actually I don't think I can make it much cleaner than it is.

I still prefer to set up a server... But let's discuss this on the retreat.
Will review the current code when I have time.

@zjkmxy zjkmxy self-assigned this Nov 18, 2023
@zjkmxy zjkmxy mentioned this issue Nov 19, 2023
34 tasks
@zjkmxy zjkmxy moved this from Planned to In Progress in NDN Workspace Development Nov 19, 2023
@zjkmxy
Copy link
Collaborator Author

zjkmxy commented Nov 21, 2023

Ref: zjkmxy/ndn-workspace-compiler

@zjkmxy zjkmxy linked a pull request Nov 23, 2023 that will close this issue
zjkmxy added a commit that referenced this issue Nov 24, 2023
@zjkmxy zjkmxy mentioned this issue Nov 24, 2023
@zjkmxy
Copy link
Collaborator Author

zjkmxy commented Nov 24, 2023

Not perfect but currently working. Close for now.
Enhancement will be handled in a different issue.

@zjkmxy zjkmxy closed this as completed Nov 24, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in NDN Workspace Development Nov 24, 2023
@zjkmxy
Copy link
Collaborator Author

zjkmxy commented Nov 26, 2023

After #28 is merged, it is able to compile PDF files completely offline after caching necessary files.
I verified that I can compile even on my phone.

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

Successfully merging a pull request may close this issue.

3 participants