定制 wenfei-huang/wkhtmltox 二次开发

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

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

wenfei-huang/wkhtmltox

最新稳定版本:0.12.6

Composer 安装命令:

composer require wenfei-huang/wkhtmltox

包简介

wkhtmltopdf and wkhtmltoimage Linux Ubuntu 20.04 focal amd64 binaries

README 文档

README

This repository contains the version 0.12.6 of wkhtmltopdf and wkhtmltoimage from the wkhtmltopdf project, check for latest (https://github.com/wkhtmltopdf/wkhtmltopdf/releases/latest).

The binaries are built for Ubuntu 20.04 focal, amd64 only AMD64 architectures are included.

Why

h4cc/wkhtmltopdf-amd64 and h4cc/wkhtmltoimage-amd64 package is outdated and gives errors on php 8.0

When it's not possible to install the latest version via .deb package with apt

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
sudo apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb

Or sometimes you just want a quick solution for your dev environment ;)

Installation

This package is published on Packagist and should be installed with Composer.

The version of the binary is equal to the git tag. Composer will install the latest version by default.

$ composer require-dev wenfei-huang/wkhtmltox

Composer will install the package in your project path into the vendor/wenfei-huang/wkhtmltox/ directory.

The binaries are located in the vendor/wenfei-huang/wkhtmltox/bin/ directory.

Composer will symlink them to the vendor/bin/ directory.

Optional: You can also symlink them to the /usr/local/bin/ directory, as apt would install normally there.

$ ln -s /absolute/path/to/your/project/vendor/wenfei-huang/wkhtmltox/bin/wkhtmltopdf_0.12.6_linux_ubuntu_focal_amd64 /usr/local/bin/wkhtmltopdf
$ ln -s /absolute/path/to/your/project/vendor/wenfei-huang/wkhtmltox/bin/wkhtmltoimage_0.12.6_linux_ubuntu_focal_amd64 /usr/local/bin/wkhtmltoimage

Check the Version:

$ wkhtmltopdf -V
wkhtmltopdf 0.12.6 (with patched qt)

Usage

If using with Laravel Snappy PDF package, you can change in the snappy config file:

    'pdf' => array(
        ...
        'binary'  => base_path('vendor/wenfei-huang/wkhtmltox/bin/wkhtmltopdf-amd64'),
        ...

    ),
    'image' => array(
        ...
        'binary'  => base_path('vendor/wenfei-huang/wkhtmltox/bin/wkhtmltoimage_0.12.6_linux_ubuntu_focal_amd64'),
        ...
    ),

With the KNP-Snappy package, you can now use the binaries to create PDFs or Images from HTML.

You can use the path constants from this project to easily locate the binary paths (with PSR 4 Autoloader):

<?php
use Knp\Snappy\Pdf;
use Knp\Snappy\Image;
use Wkhtmltox\Wkhtmltopdf;
use Wkhtmltox\Wkhtmltoimage;

$snappyPdf = new Pdf(Wkhtmltopdf::wkhtmltopdfx64);
$snappyImage = new Image(Wkhtmltoimage::wkhtmltoimagex64)

OR If you symlinked the binaries to /usr/local/bin:

<?php
use Knp\Snappy\Pdf;
use Knp\Snappy\Image;

$snappyPdf = new Pdf('/usr/local/bin/wkhtmltopdf');
$snappyImage = new Image('/usr/local/bin/wkhtmltoimage');

License

This package is published under the same GNU General Public License v3.0 LICENSE as the wkhtmltopdf project.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3.0-only
  • 更新时间: 2022-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固