定制 wucdbm/pdf-generator-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

wucdbm/pdf-generator-bundle

Composer 安装命令:

composer require wucdbm/pdf-generator-bundle

包简介

A WKHTMLTOPDF based PDF Generator

README 文档

README

PDF Generator Bundle based on wkhtmltopdf

Requirements

  • xvfb to be installed on your server (apt-get install xvfb on debian/ubuntu)

By default this bundle uses the h4cc/wkhtmltopdf-i386 package's binary. To use your system binary, add this to your parameters.yml.dist file and do a composer install

    wucdbm_pdf_generator.binary: wkhtmltopdf

Register the bundle in your AppKernel

<?php
public function registerBundles() {
    $bundles = [
        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        // Add WucdbmPdfGeneratorBundle to your AppKernel
        new \Wucdbm\Bundle\PdfGeneratorBundle\WucdbmPdfGeneratorBundle(),
    ];
}

Basic Usage

<?php 
/** @var \Wucdbm\Bundle\PdfGeneratorBundle\Generator\PdfGenerator $generator */
$generator = $container->get('wucdbm_pdf_generator.generator');
$filename = 'someFile.pdf';
// Get a PdfResult. The wkPrint and bootstrap methods both return a PdfResult
/** @var \Wucdbm\Bundle\PdfGeneratorBundle\Generator\PdfResult $result */
$result = $generator->wkPrint($html);
// The PdfResult is the result of the PDF generation. It has access to the temporary PDF file
$tempPdfPath = $result->realPath();
// return a Symfony Response
return $generator->bootstrap($html)->response($filename);
// return a Symfony Response and copy the file some place else
// The Generator does NOT save the files; it will unlink them as soon as the request is finished
// The copy() method returns PrintResult
return $generator->bootstrap($html)->copy('/some/location/someFile.pdf')->response($filename);
// And last, you can also get the PDF file contents as string
$contents = $generator->bootstrap($html)->contents();

TODO

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2017-08-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固