Skip to content

Commit

Permalink
add config variable use active forms
Browse files Browse the repository at this point in the history
  • Loading branch information
mccarlosen committed Aug 24, 2021
1 parent 2e65809 commit a05c619
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
1 change: 1 addition & 0 deletions config/pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
'temp_dir' => rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR),
'pdfa' => false,
'pdfaauto' => false,
'use_active_forms' => false,
];
49 changes: 25 additions & 24 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Important Notes

> Currently supported mpdf version `8.0` with FPDF version 2 and PHP version >= 7.0
> Currently supported mpdf version `8.0` with FPDF version 2 and PHP version >= 7.0. [MPDF documentation](https://mpdf.github.io/)
> mPDF will timeout on [fetching external HTTP resources](https://github.com/mpdf/mpdf#known-server-caveats) when using single-threaded servers
> such as `php -S` or `artisan serve`. Use a proper webserver for full functionality.
Expand Down Expand Up @@ -69,30 +69,31 @@ You can use a custom file to overwrite the default configuration. Just create `c

```php
return [
'mode' => '',
'format' => 'A4',
'default_font_size' => '12',
'default_font' => 'sans-serif',
'margin_left' => 10,
'margin_right' => 10,
'margin_top' => 10,
'margin_bottom' => 10,
'margin_header' => 0,
'margin_footer' => 0,
'orientation' => 'P',
'title' => 'Laravel mPDF',
'author' => '',
'watermark' => '',
'show_watermark' => false,
'watermark_font' => 'sans-serif',
'display_mode' => 'fullpage',
'watermark_text_alpha' => 0.1,
'custom_font_dir' => '',
'custom_font_data' => [],
'mode' => '',
'format' => 'A4',
'default_font_size' => '12',
'default_font' => 'sans-serif',
'margin_left' => 10,
'margin_right' => 10,
'margin_top' => 10,
'margin_bottom' => 10,
'margin_header' => 0,
'margin_footer' => 0,
'orientation' => 'P',
'title' => 'Laravel mPDF',
'author' => '',
'watermark' => '',
'show_watermark' => false,
'watermark_font' => 'sans-serif',
'display_mode' => 'fullpage',
'watermark_text_alpha' => 0.1,
'custom_font_dir' => '',
'custom_font_data' => [],
'auto_language_detection' => false,
'temp_dir' => rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR),
'pdfa' => false,
'pdfaauto' => false,
'temp_dir' => rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR),
'pdfa' => false,
'pdfaauto' => false,
'use_active_forms' => false,
];
```

Expand Down
4 changes: 3 additions & 1 deletion src/LaravelMpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public function __construct($config = [])
$this->mpdf->showWatermarkText = $this->getConfig('show_watermark');
$this->mpdf->watermark_font = $this->getConfig('watermark_font');
$this->mpdf->watermarkTextAlpha = $this->getConfig('watermark_text_alpha');
// use active forms
$this->mpdf->useActiveForms = $this->getConfig('use_active_forms');
}

protected function getConfig($key) {
Expand Down Expand Up @@ -122,4 +124,4 @@ public function stream($filename = 'document.pdf')
{
return $this->mpdf->Output($filename, 'I');
}
}
}

0 comments on commit a05c619

Please sign in to comment.