marifhasan/printpdf 问题修复 & 功能扩展

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

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

marifhasan/printpdf

最新稳定版本:v1.0

Composer 安装命令:

composer require marifhasan/printpdf

包简介

Quick pdf builder, Laravel, PHP

README 文档

README

PrintPDF is a PHP, Laravel package for mpdf/mpdf library

Installation

Official installation method is via composer and its packagist package marifhasan/printpdf.

composer require marifhasan/printpdf --dev

Usage

Add OrderPrint pdf for your application. by below command

php artisan make:print OrderPrint

It will create app/Prints/OrderPrint.php File inside app directory, add resources/views/prints directory and order-print.blade.php

Modify app/Prints/OrderPrint.php and resources/views/prints/order-print.blade.php for desired pdf.

For modifying the pdf property change the 'options' method in side of app/Prints/OrderPrint.php file.

Usage

Declare route in your routes/web.php file.

use 

Route::get('/{order:id}/print', [OrderController::class, 'print'])->name('print'); // order.print

Your OrderController.php add this method

use App\Models\Order;
use App\Prints\OrderPrint;
use Marifhasan\PrintPDF\PrintPDF;

/**
* Display the order print form.
*/
public function print(Order $order)
{
	return PrintPDF::make(new OrderPrint($order))
		->inline();
}

available methods for mPDF property

inline() for 'I' //mPDF property
download() for 'D' //mPDF property
file() for 'F' //mPDF property
string() for 'S' //mPDF property

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-29