Open swissspidy opened 8 months ago
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.
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: