承接 tfox/mpdf-port-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tfox/mpdf-port-bundle

最新稳定版本:2.1.0

Composer 安装命令:

composer require tfox/mpdf-port-bundle

包简介

A wrapper for mPDF class which allows to use mPDF in Symfony2 projects

关键字:

README 文档

README

Using Composer (Symfony 2.x, Symfony 3.0.x)

  • Run a command

    composer require tfox/mpdf-port-bundle
    

  • Add a new line to app/AppKernel.php:

    $bundles = array(
    ...
    new TFox\MpdfPortBundle\TFoxMpdfPortBundle(),
    )
    

Using deps-file (Symfony 2.0.x)

  • Add a new entry to your deps file:

    [TFoxMpdfPortBundle]
      git=https://bitbucket.org/tasmanianfox/mpdfportbundle.git
      target=/bundles/TFox/MpdfPortBundle 
    

  • Add a new line to app/AppKernel.php:

    new TFox\MpdfPortBundle\TFoxMpdfPortBundle(), 
    

  • Add a new line to app/autoload.php:

    'TFox' => DIR.'/../vendor/bundles',
    

  • Run a command

    php bin/vendors install
    

A Quick Start guide

How to create a Response object

This small example creates a PDF document with format A4 and portrait orientation:

public function indexAction()
{
   return new \TFox\MpdfPortBundle\Response\PDFResponse($this->getMpdfService()->generatePdf('Hello World'));
}

/**

  • @return \TFox\MpdfPortBundle\Service\PDFService */ private function getMpdfService() { return $this->get('t_fox_mpdf_port.pdf'); }

Generate a variable with PDF content

Sometimes it is necessary to get a variable which content is PDF document.

$myVar = $this->getMpdfService()->generatePdf('Hello World');

How to get an instance of \mPDF class

If you would like to work with mPDF class itself, you can use a getMpdf method:

$mpdf = new \Mpdf\Mpdf();

Additional options

Additional options might be passed via the second argument:

public function indexAction()
{
    return new \TFox\MpdfPortBundle\Response\PDFResponse($this->getMpdfService()->generatePdf('Hello World', array(
            'format' => 'A4-L' // A4 page, landscape orientation
    )));
}

Detailed description is available on official manual page: https://mpdf.github.io/

统计信息

  • 总下载量: 518.65k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-05-11