akyos/mpdf-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

akyos/mpdf-bundle

Composer 安装命令:

composer require akyos/mpdf-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 akyos/mpdf-bundle
  • Add a new line to app/AppKernel.php:
$bundles = [
  ...
  new Akyos\MpdfBundle\AkyosMpdfBundle(),
]

Using deps-file (Symfony 2.0.x)

  • Add a new entry to your deps file:
[AkyosMpdfBundle]
    git=https://github.com/akyoscommunication/mpdf-bundle.git
    target=/bundles/Akyos/MpdfBundle 
  • Add a new line to app/AppKernel.php:
new Akyos\MpdfBundle\AkyosMpdfBundle(), 
  • Add a new line to app/autoload.php:
'Akyos' => __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 \Akyos\MpdfBundle\Response\PDFResponse($this->getMpdfService()->generatePdf('Hello World'));
}

/**
 * @return \Akyos\MpdfBundle\Service\PDFService
 */
private function getMpdfService()
{
  return $this->get('akyos_mpdf.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 \Akyos\MpdfBundle\Response\PDFResponse($this->getMpdfService()->generatePdf('Hello World', [
            'format' => 'A4-L' // A4 page, landscape orientation
    ]));
}

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固