eab/inline-pdf-bundle

用于在友好URL中显示PDF文件的eZ Publish Bundle

0.2 2016-04-18 07:33 UTC

This package is not auto-updated.

Last update: 2024-09-11 23:57:21 UTC


README

##摘要

一个eZ Publish Bundle,提供路由和控制器,使得可以通过友好的URL别名直接显示PDF文件。

##版权

版权(C)2015 Andy Caiger,Enterprise AB Ltd

##许可

许可协议:GNU通用公共许可证2.0

##特性

假设有一个页面 http://www.example.com/Folder/File,其中有一个包含名为 My document.pdf 的二进制文件的字段。您可以使用 http://www.example.com/Folder/File/My%20document.pdf 访问PDF的嵌入版本。

您也可以使用传统的模块在 http://www.example.com/content/download/... 下载它

##用法

在模板中生成URL的示例

{% set file = content.getField( 'file' ) %}
<a href="{{ path( location ) ~ '/' ~ file.value.fileName | escape( 'url' ) }}">
    <button class="btn btn-default btn-lg" type="button">View</button>
</a>

##安装

  1. 将bundle下载到 src/Eab/InlinePdfBundle 或使用composer

     composer require --update-no-dev --prefer-dist eab/inline-pdf-bundle
    
  2. 编辑 registerBundles()ezpublish/EzPublishKernel.php 并添加以下内容

     new Eab\InlinePdfBundle\EabInlinePdfBundle(),
    
  3. ezpublish/config/routing.yml 中添加以下内容

     eab_inlinepdf:
         resource: "@EabInlinePdfBundle/Resources/config/routing.yml"
    

##注意事项

没有外部文件存储的支持。假设文件存储在eZ Publish传统的文件树中。