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

Integrating pdfobject.js to allow quartz to serve PDF files, just like obsidian can do with additional plugins. #1153

Closed
anoduck opened this issue May 21, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@anoduck
Copy link

anoduck commented May 21, 2024

Is your feature request related to a problem? Please describe.

Integrating pdfobject or Mozilla's pdf.js is a priority for my quartz installation. This would allow quartz to serve the pdf documents currently being used as reference material on the site. In Hugo such an integration would almost be effortless, but being completely unfamiliar with typescript, the task of integration is enigmatic.

Describe the solution you'd like

Quartz already utilizes CDNs quite effectively, which is why pdfobject appeared to be the easiest means of integrating a pdf viewer into quartz. Implementation would be as easy as dropping in the reference to the library being served by the CDN, and include some additional code to ensure quartz recognizes links to pdf files.

For a vanilla HTML file, the steps would be:

  1. Add the link to the CDN:
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.3.0/pdfobject.min.js" integrity="sha512-Nr6NV16pWOefJbWJiT8SrmZwOomToo/84CNd0MN6DxhP5yk8UAoPUjNuBj9KyRYVpESUb14RTef7FKxLVA4WGQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  1. Provide a reference in the html:
<div id="my-pdf"></div>
  1. Add the additional javascript to load the file at the reference:
<script>PDFObject.embed("/path/to/file.pdf", "#my-pdf");</script>

Describe alternatives you've considered

Integration with mozilla's pdf.js, which pdfobject uses, is another option. Although, it may be more appealing for a more robust and streamlined solution, at first glance, integration appeared more cumbersome and bulky.

Additional context

The desire for this feature arose from discovering the plugins that allow embeding pdf files in obsidian did not translate at all over to quartz, meaning the pdf file and/or link to the pdf file was completely absent from the page. Although full integration with quartz was never assumed, a link to the referenced file was assumed.

@anoduck anoduck added the enhancement New feature or request label May 21, 2024
@anoduck anoduck changed the title Integrating pdfobject.js to allow quartz to serve PDF files, just like obsidian currently does. Integrating pdfobject.js to allow quartz to serve PDF files, just like obsidian can do with additional plugins. May 21, 2024
@jackyzha0
Copy link
Owner

You can do this via an iframe or just a media embed. Extra 3P plugins can be added on your own

@anoduck
Copy link
Author

anoduck commented Jun 3, 2024

You can do this via an iframe or just a media embed. Extra 3P plugins can be added on your own

Ahhh... I see now. Yes, you are quite right. Good deal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants