You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a library for creating PDFs from HTML rendered with the SkPDF backend via Chrome. In order to do this, you can opt to use one of the supported drivers:
If you are planning to use the [`chrome-pdf`](https://github.com/SynergiTech/chrome-pdf) driver to render PDFs locally, you should also make sure to install this from npm.
18
18
19
-
### browserless
20
-
If you are planning to use the [browserless](https://www.browserless.io/) driver to render PDFs remotely or take screenshots, you should register for an API key. Remember that local assets cannot be rendered by browserless.
19
+
### Browserless
20
+
If you are planning to use the [Browserless](https://www.browserless.io/) driver to render PDFs remotely or take screenshots, you should register for an API key. Remember that local assets cannot be rendered by Browserless.
21
21
22
22
## Usage
23
23
A common interface is provided via AbstractPDF. The options presented via this class will be available from all drivers.
@@ -26,17 +26,32 @@ You should instantiate one of the available drivers, potentially passing options
26
26
```php
27
27
use SynergiTech\ChromePDF\Chrome;
28
28
use SynergiTech\ChromePDF\Browserless;
29
-
use SynergiTech\ChromePDF\Browserless\Screenshot;
30
29
31
30
$pdf = new Chrome('path-to-chrome-pdf');
32
31
$pdf->renderContent('<h1>test</h1>');
33
32
34
33
$pdf = new Browserless('your-api-key');
35
34
$pdf->renderContent('<h1>test</h1>');
35
+
```
36
+
37
+
### Advanced Browserless Usage
38
+
39
+
You can optionally use specific endpoints when you create a client.
40
+
41
+
```php
42
+
use SynergiTech\ChromePDF\Browserless;
43
+
44
+
$pdf = new Browserless('your-api-key', Browserless\EndpointsEnum::London);
45
+
```
46
+
47
+
As this library essentially functions as an API client for Browserless, we have also implemented the screenshot API.
48
+
49
+
```php
50
+
use SynergiTech\ChromePDF\Browserless;
36
51
37
52
// For information on options, see https://www.browserless.io/docs/screenshot#custom-options.
38
53
// `render()` defaults to using jpeg with a quality of 75 and fullPage set to false.
39
-
$file = new Screenshot('your-api-key');
54
+
$file = new Browserless\Screenshot('your-api-key');
0 commit comments