Inserting my pdf in my blogs

青春壹個敷衍的年華 提交于 2019-12-21 05:26:08

问题


I have a posts page which stores every individual blog. And each blog has a pdf file. I can upload the pdf via the blog page but when I execute my code through the for-loop on posts - post.file_doucment_path it just shows the pdf file location. Do I need to add a seperate js pdf reader package to get it working? Cheers.


回答1:


HTML5 <object> element can embed PDFs in a page without an external library.

<object data="the.pdf" width="1000" height="1000" type='application/pdf'/>

Just replace "the.pdf" with your file document path with Jekyll syntax.

e.g.
<object data="{{ post.file_document_path }}" width="1000" height="1000" type='application/pdf'/>



来源:https://stackoverflow.com/questions/46105960/inserting-my-pdf-in-my-blogs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!