1
我想要一个快速简便(插件依赖)PDF内嵌视图,而不仅仅是一个下载链接文件的项目。嵌入PDF在敏捷文件视图
我的自定义文件架构的样子:
class IBulletin(form.Schema):
...
form.primary('file')
file = NamedBlobFile(
title=_(u"File"),
required=False,
)
class Bulletin(Item):
grok.implements(IBulletin, IFile)
我按照指示在http://www.kcsts.co.uk/blog/embedded-pdf-in-file-view-with-plone和它的作品为原型文件的看法,但似乎不工作的敏捷文件视图。
我猜的关键部分是内<object ...>
和<embed ...>
。我试的模板如下所示:
<metal:content-core define-macro="content-core"
tal:define="content_type context/file/contentType|nothing;
location string:${context/absolute_url}/@@download/file/${context/file/filename};
v python:context.restrictedTraverse('contenttype_utils');">
<object class="viewembededfile" type="application/pdf" data=""
tal:condition="python:content_type.endswith('pdf')"
tal:attributes="data location; width string:100%; height string:900">
<a href="" tal:attributes="href location">Please click here to download the PDF.</a>
<embed src="" class="viewembededfile" type="application/pdf"
tal:attributes="src location">
</embed>
</object>
...
我也试过<object ... attributes="data context/absoulte_url;"
和<embed ... attributes="src context/absolute_url"
,但不起作用。它只显示灰色背景的块。请参阅图片以供参考。
有什么建议吗?
我有同样的问题,我尝试做一些事情,请参阅[敏捷文档](http://docs.plone.org/external/plone.app.dexterity/docs/advanced/files-and-images.html ),但显示框灰色'问题加载PDF',我觉得@Mathias可以帮助我们。 –