Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [Force file to display in a browser](#force-file-to-display-in-a-browser)
- [Set a pdf background easily](#set-a-pdf-background-easily)
- [Create pdf with latte only](#create-pdf-with-latte-only)
- [Configuration of custom fonts for mPDF](#configuration-of-custom-fonts-for-mpdf)
- [Configuration of custom temp dir for mPDF in PdfResponse](#configuration-of-custom-temp-dir-for-mpdf-in-pdfresponse)

## Usage
Expand Down Expand Up @@ -155,6 +156,32 @@ public function actionPdf()
}
```

### Configuration of custom fonts for mPDF

```php
use Contributte\PdfResponse\PdfResponse;

public function actionPdf()
{
$template = $this->createTemplate();
$template->setFile(__DIR__ . "/path/to/template.latte");

$pdf = new PdfResponse($template);
$pdf->mpdfConfig = [
'fontDir' => [__DIR__ . '/fonts'],
'fontdata' => [
'poppins' => [
'R' => 'Poppins-Regular.ttf',
'B' => 'Poppins-Bold.ttf',
],
],
'default_font' => 'poppins',
];

$this->sendResponse($pdf);
}
```

### Configuration of custom temp dir for mPDF in PdfResponse

```neon
Expand Down
Loading