akrambe/shotify

使用无头Chrome将HTML转换为PDF和网页截图,无需Nodejs/npm。

0.1 2019-07-29 05:15 UTC

This package is auto-updated.

Last update: 2024-09-29 06:02:37 UTC


README

License: GPL v3 Build Status Packagist Version PHP from Packagist

无需Nodejs/npm!

文档

安装

安装此包的最佳方式是通过终端的Composer。

composer require akrambe/shotify

用法

<?php

require('vendor/autoload.php');

// PDF print from url
Shotify\Launcher::fromUrl('http://example.com')
            ->saveToPDF('example.pdf');

// Screenshot
Shotify\Launcher::fromUrl('http://example.com')
            ->captureScreenshot('hello.png',
                (new Shotify\Options\ScreenshotOptions)
                    ->setQuality(70)
                    ->setFormat('png')
            );
            
// Get document outer HTML
$html = Shotify\Launcher::fromUrl('http://example.com')
            ->outerHtml();
            

许可协议

Shotify遵循GNU通用公共许可证v3.0的条款(有关详细信息,请参阅LICENSE文件)。