问题
I've set up a simle .html page that'll load cast-index.php to the Chromecast device (using the API key). The cast-index.php is supposed to show a schedule in .pdf file format. So far I've tried multiple ways to make this work and all of them have failed.
A simple <embed src="pdf/test.pdf" width="100%" height="50%" type='application/pdf' />
doesn't seem to function at all. Loading the cast-index.php directly into the Chrome browser shows a perfectly readable .pdf file however loading the same page in the Chromecast device does not - nothing but an empty frame.
I have confirmed nothing's wrong with the links - <img>
tags work just fine using the same folder structure.
Next I've attempted using the Google Drive method for putting the full screen view of this .pdf file in Google Drive as an iframe:
<iframe src="https://drive.google.com/a/ictmbo.nl/file/d/0B1ogN-bhjfGRZFRTLWhydGJzUlU/preview" width="100%" height="50%"></iframe>
This does its job but leaves me with little control regarding the view and zooming of the .pdf file - especially considering I'm using <meta http-equiv="refresh" content="300">
to refresh the page every 5 minutes, thus restoring any manual zooming or scrolling done by the user viewing this page.
Am I missing something here? I find it hard to believe relying on clumsy <iframe>
tags is the only way display a .pdf file in on Chromecast devices.
Why does the <embed>
not function properly (or <object>
for that matter)?
回答1:
PDF is not a supported format for chromecast and there are no extensions to support that on the chrome running on the chromecast either, so you have to find a way to render that PDF as an html or so; some have even tried to create images from pages of the doc and cast images but I don't know how successful they have been. Another option is to use the remote display apis.
来源:https://stackoverflow.com/questions/33474728/viewing-pdf-files-in-chromecast