salva/pdfjs-bundle

此包已被废弃,不再维护。未建议替代包。

此包提供了Mozilla的pdfjs库到Symfony2的简单集成。

安装: 6,868

依赖者: 0

建议者: 0

安全: 0

星标: 3

关注者: 2

分支: 2

开放问题: 0

语言:JavaScript

类型:symfony-bundle

dev-master / 1.0.x-dev 2013-04-25 15:36 UTC

This package is auto-updated.

Last update: 2023-10-10 12:54:49 UTC


README

Build Status

此包提供了将 "PDF.JS库" 从Mozilla集成到Symfony2的简单方法。

安装

1) 下载SalvaPdfJsBundle

使用供应商脚本

将以下行添加到项目根目录下的deps文件中

[SalvaPdfJsBundle]
    git=http://github.com/nibsirahsieu/SalvaPdfJsBundle.git
    target=bundles/Salva/PdfJsBundle

接下来,通过运行以下命令更新供应商

$ ./bin/vendors install

使用composer

运行以下命令让composer下载包

$ php composer.phar require salva/pdfjs-bundle:1.0.*@dev

2) 配置自动加载器(使用composer时不需要)

将以下条目添加到自动加载器中

<?php
// app/autoload.php

$loader->registerNamespaces(array(
    // ...

    'Salva'        => __DIR__.'/../vendor/bundles',
));

3) 启用包

最后,在内核中启用包

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...

        new Salva\PdfJsBundle\SalvaPdfJsBundle(),
    );
}

基本用法

<?php

$file = '/uploads/yourpdf.pdf'; //relative to your website root directory

return $this->get('salva_pdf_js.controller')->renderPdf($file);