Embedding a pdf into a webpage

152 Views Asked by At

I'm trying to embed a pdf into a page and I'm using the 'file' field in contenttypes.yml

file:  
    type: file  
    extensions: [ pdf, doc, docx, ppt, pptx ]  

The field appears in the content editor and it evens insert some code into the page. However the result is disappointing, the navigator only outputs a line that goes like that :

file:2014/12/doc.pdf

Can someone tell me what did I do wrong ?

2

There are 2 best solutions below

0
On BEST ANSWER

You should add your own HTML around the file field, to allow users to download it. Something like this:

{% if record.file is not empty %} 
Click to download: <a href="{{ paths.files }}{{ record.file }}">{{record.file}}<a>
{% endif %}
0
On

Additionally if you want to embed the PDF into the page you will need to use a third party plugin since they aren't natively supported.

Google docs offer one, you can grab the embed code here:

https://docs.google.com/viewer