Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting my pdf in my blogs

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.

like image 481
kcuhcx2 Avatar asked Sep 07 '17 22:09

kcuhcx2


People also ask

How do I add a PDF to my WordPress blog?

To get started, login to your WordPress admin area and then go to Media. After that, click the “Add New” button. Simply drag and drop your PDF file in WordPress or click the “Select Files” button to upload it. After that, the PDF file will be uploaded to your WordPress website.

Can we post PDF on Blogger?

Google Docs enables you to embed your PDF document in your Blogger post. You need to upload your PDF file to Google Docs and update the visibility options. Your PDF includes File tools to produce the HTML embed code of the URL address needed for your Blogger post.


1 Answers

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'/>

like image 150
Jack Leahy Avatar answered Sep 23 '22 20:09

Jack Leahy