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

Use PDF.js for inline embeds #277

Open
swissspidy opened this issue Dec 21, 2023 · 1 comment
Open

Use PDF.js for inline embeds #277

swissspidy opened this issue Dec 21, 2023 · 1 comment
Labels
enhancement New feature or request p3

Comments

@swissspidy
Copy link
Owner

swissspidy commented Dec 21, 2023

The file block has this support for inline embeds/previews for PDFs and other file types. Doesn't really seem to work in the editor, and on the frontend support is limited.

It could be interesting to expand support by using PDF.js for viewing PDF files.

Would need to see how lightweight it is etc. But the viewer could possibly be lazy loaded and first display the poster image.

Would be interesting to query HTTP Archive for wp-block-file__embed usage. Maybe add to https://github.com/felixarntz/custom-metrics/blob/main/dist/cms.js? Though seems like these embeds are rather lightweight as it just requires loading the PDF file and nothing more. So adding PDF.js on top of that would be heavier.

Notes from the doc:

The viewer is built on the display layer and is the UI for the PDF viewer in Firefox and the other browser extensions within the project. It can be a good starting point for building your own viewer. However, we do ask if you plan to embed the viewer in your own site, that it not just be an unmodified version. Please re-skin it or build upon it.

@swissspidy swissspidy added the enhancement New feature or request label Dec 21, 2023
@swissspidy swissspidy added feature and removed enhancement New feature or request labels Jan 3, 2024
@swissspidy swissspidy added the p3 label Jun 6, 2024
@swissspidy swissspidy added enhancement New feature or request and removed feature labels Sep 1, 2024
@swissspidy
Copy link
Owner Author

Doesn't really seem to work in the editor, and on the frontend support is limited.

It does work, but not with cross-origin isolation, as <object> doesn't support crossorigin.

So at least in the editor using PDF.js seems like the only way to address this.

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

No branches or pull requests

1 participant