Skip to content

Commit f03c274

Browse files
committed
Version 6.0.0
Require October CMS 3.0
1 parent 63d93e6 commit f03c274

23 files changed

+267
-239
lines changed

Plugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function pluginDetails()
1919
'name' => 'renatio.dynamicpdf::lang.plugin.name',
2020
'description' => 'renatio.dynamicpdf::lang.plugin.description',
2121
'author' => 'Renatio',
22-
'icon' => 'icon-file-pdf-o',
22+
'icon' => 'octo-icon-file-pdf-o',
2323
'homepage' => 'https://octobercms.com/plugin/renatio-dynamicpdf',
2424
];
2525
}
@@ -74,7 +74,7 @@ public function registerSettings()
7474
'templates' => [
7575
'label' => 'renatio.dynamicpdf::lang.menu.label',
7676
'category' => 'renatio.dynamicpdf::lang.menu.category',
77-
'icon' => 'icon-file-pdf-o',
77+
'icon' => 'octo-icon-file-pdf-o',
7878
'url' => Backend::url('renatio/dynamicpdf/templates'),
7979
'description' => 'renatio.dynamicpdf::lang.menu.description',
8080
'permissions' => ['renatio.dynamicpdf.manage_templates'],

README.md

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Dynamic PDF Plugin
22

3-
**Demo URL:** https://october-demo.renatio.com/backend/backend/auth/signin
4-
**Login:** dynamicpdf
3+
**Demo URL:** https://october-demo.renatio.com/backend/backend/auth/signin
4+
5+
**Login:** dynamicpdf
6+
57
**Password:** dynamicpdf
68

79
This plugin allows developers to create and edit PDF templates with a simple user interface.
@@ -27,9 +29,11 @@ Please check my other [plugins](https://octobercms.com/author/Renatio).
2729
Please use [GitHub Issues Page](https://github.com/mplodowski/dynamicpdf-plugin/issues) to report any issues with
2830
plugin.
2931

30-
> Reviews should not be used for getting support or reporting bugs, if you need support please use the Plugin support link.
32+
> Reviews should not be used for getting support or reporting bugs, if you need support please use the Plugin support
33+
> link.
3134
32-
Icon made by [Darius Dan](https://www.flaticon.com/authors/darius-dan) from [www.flaticon.com](https://www.flaticon.com/).
35+
Icon made by [Darius Dan](https://www.flaticon.com/authors/darius-dan)
36+
from [www.flaticon.com](https://www.flaticon.com/).
3337

3438
# Documentation
3539

@@ -117,9 +121,9 @@ name = "Default PDF layout"
117121

118122
The configuration section sets the PDF view parameters. The following configuration parameters are supported:
119123

120-
Parameter | Description
121-
------------- | -------------
122-
**name** | the layout name, required.
124+
| Parameter | Description |
125+
|-----------|----------------------------|
126+
| **name** | the layout name, required. |
123127

124128
### Using PDF layouts
125129

@@ -160,20 +164,21 @@ orientation = "portrait"
160164

161165
The configuration section sets the PDF view parameters. The following configuration parameters are supported:
162166

163-
Parameter | Description
164-
------------- | -------------
165-
**title** | the template title, required.
166-
**layout** | the layout code, optional.
167-
**description** | the template description, optional.
168-
**size** | the template paper size, optional, default `a4`.
169-
**orientation** | the template paper orientation, optional, default `portrait`.
167+
| Parameter | Description |
168+
|-----------------|---------------------------------------------------------------|
169+
| **title** | the template title, required. |
170+
| **layout** | the layout code, optional. |
171+
| **description** | the template description, optional. |
172+
| **size** | the template paper size, optional, default `a4`. |
173+
| **orientation** | the template paper orientation, optional, default `portrait`. |
170174

171175
### Using PDF templates
172176

173177
PDF templates reside in the database and can be created in the back-end area via *Settings > PDF > PDF Templates*.
174178
The **code** specified in the template is a unique identifier and cannot be changed once created.
175179

176-
> **Note:** If the PDF template does not exist in the system, this code will attempt to find a PDF view with the same code.
180+
> **Note:** If the PDF template does not exist in the system, this code will attempt to find a PDF view with the same
181+
> code.
177182
178183
## Registering PDF templates and layouts
179184

@@ -272,21 +277,21 @@ See [Dompdf\Options](https://github.com/dompdf/dompdf/blob/master/src/Options.ph
272277

273278
## Methods
274279

275-
| Method | Description |
276-
|---|---|
277-
| loadTemplate($code, array $data = [], $encoding = null) | Load backend template |
278-
| loadLayout($code, array $data = [], $encoding = null) | Load backend layout |
279-
| loadHTML($string, $encoding = null) | Load HTML string |
280-
| loadFile($file) | Load HTML string from a file |
281-
| parseTemplate(Template $template, array $data = []) | Parse backend template using Twig |
282-
| parseLayout(Layout $layout, array $mergeData = []) | Parse backend layout using Twig |
283-
| getDomPDF() | Get the DomPDF instance |
284-
| setPaper($paper, $orientation = 'portrait') | Set the paper size and orientation (default A4/portrait) |
285-
| setWarnings($warnings) | Show or hide warnings |
286-
| output() | Output the PDF as a string |
287-
| save($filename) | Save the PDF to a file |
288-
| download($filename = 'document.pdf') | Make the PDF downloadable by the user |
289-
| stream($filename = 'document.pdf') | Return a response with the PDF to show in the browser |
280+
| Method | Description |
281+
|---------------------------------------------------------|----------------------------------------------------------|
282+
| loadTemplate($code, array $data = [], $encoding = null) | Load backend template |
283+
| loadLayout($code, array $data = [], $encoding = null) | Load backend layout |
284+
| loadHTML($string, $encoding = null) | Load HTML string |
285+
| loadFile($file) | Load HTML string from a file |
286+
| parseTemplate(Template $template, array $data = []) | Parse backend template using Twig |
287+
| parseLayout(Layout $layout, array $mergeData = []) | Parse backend layout using Twig |
288+
| getDomPDF() | Get the DomPDF instance |
289+
| setPaper($paper, $orientation = 'portrait') | Set the paper size and orientation (default A4/portrait) |
290+
| setWarnings($warnings) | Show or hide warnings |
291+
| output() | Output the PDF as a string |
292+
| save($filename) | Save the PDF to a file |
293+
| download($filename = 'document.pdf') | Make the PDF downloadable by the user |
294+
| stream($filename = 'document.pdf') | Return a response with the PDF to show in the browser |
290295

291296
All methods are available through Facade class `Renatio\DynamicPDF\Classes\PDF`.
292297

@@ -383,7 +388,8 @@ Recommended approach is to save PDF file locally and return redirect to PDF file
383388

384389
### Page numbers
385390

386-
Page numbers can be generated using PHP. Inline PHP is disabled by default, because it can be a security risk. You can enable inline PHP using `setIsPhpEnabled` method.
391+
Page numbers can be generated using PHP. Inline PHP is disabled by default, because it can be a security risk. You can
392+
enable inline PHP using `setIsPhpEnabled` method.
387393

388394
```
389395
return PDF::loadTemplate('renatio::invoice')

UPGRADE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,9 @@ in [documentation](https://github.com/mplodowski/dynamicpdf-plugin/blob/master/R
5151
## Upgrading To 5.0.1
5252

5353
Plugin requires OctoberCMS v2.1.x with Laravel 6 and PHP >=7.2.
54+
55+
## Upgrading To 6.0.0
56+
57+
Plugin requires October CMS version 3.0 or higher, Laravel 9.0 or higher and PHP >=8.0.
58+
59+
Drop support for October CMS version 2.x.

classes/SyncTemplates.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public function handle()
1313
try {
1414
$this->checkFontsDir();
1515

16+
$this->checkPublicDir();
17+
1618
$this->createLayouts();
1719

1820
$registeredTemplates = PDFManager::instance()->listRegisteredTemplates();
@@ -84,4 +86,11 @@ protected function checkFontsDir()
8486
mkdir(config('dompdf.defines.font_dir'), 0755, true);
8587
}
8688
}
89+
90+
protected function checkPublicDir()
91+
{
92+
if (! file_exists('public')) {
93+
mkdir('public', 0755, true);
94+
}
95+
}
8796
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
}
2020
],
2121
"require": {
22-
"barryvdh/laravel-dompdf": "^0.9.0",
22+
"barryvdh/laravel-dompdf": "^1.0",
2323
"composer/installers": "~1.0"
2424
}
2525
}

controllers/layouts/create.htm renamed to controllers/layouts/create.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
<?= $this->formRender() ?>
1717
</div>
1818

19-
<div class="form-buttons p-t">
19+
<div class="form-buttons pt-4">
2020
<div class="loading-indicator-container">
2121
<button type="submit"
2222
data-request="onSave"
2323
data-hotkey="ctrl+s, cmd+s"
24-
data-load-indicator="<?= e(trans('backend::lang.form.creating_name', ['name' => $formRecordName])) ?>"
24+
data-load-indicator="<?= e(trans('backend::lang.form.creating_name',
25+
['name' => $formRecordName])) ?>"
2526
class="btn btn-primary">
2627
<?= e(trans('backend::lang.form.create')) ?>
2728
</button>
@@ -30,7 +31,8 @@
3031
data-request="onSave"
3132
data-request-data="close:1"
3233
data-hotkey="ctrl+enter, cmd+enter"
33-
data-load-indicator="<?= e(trans('backend::lang.form.creating_name', ['name' => $formRecordName])) ?>"
34+
data-load-indicator="<?= e(trans('backend::lang.form.creating_name',
35+
['name' => $formRecordName])) ?>"
3436
class="btn btn-default">
3537
<?= e(trans('backend::lang.form.create_and_close')) ?>
3638
</button>
@@ -53,4 +55,4 @@
5355
<?= e(trans('renatio.dynamicpdf::lang.layouts.return')) ?>
5456
</a>
5557
</p>
56-
<?php endif ?>
58+
<?php endif ?>
Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
<?php Block::put('breadcrumb') ?>
2-
<ul>
3-
<li>
4-
<a href="<?= Backend::url('renatio/dynamicpdf/templates/index/layouts') ?>">
5-
<?= e(trans('renatio.dynamicpdf::lang.layouts.label')) ?>
6-
</a>
7-
</li>
8-
<li><?= e($this->pageTitle) ?></li>
9-
</ul>
10-
<?php Block::endPut() ?>
11-
12-
<?php if (! $this->fatalError) : ?>
13-
<div class="form-preview" style="display: flex; justify-content: center;">
14-
<iframe src="<?= Backend::url('renatio/dynamicpdf/layouts/html/' . $formModel->id) ?>"
15-
style="width: 793px; height: 1121px; border: 1px solid #9098a2;"></iframe>
16-
</div>
17-
18-
<div class="form-buttons">
19-
<a class="btn btn-default"
20-
href="<?= Backend::url('renatio/dynamicpdf/layouts/update/' . $formModel->id) ?>">
21-
<?= e(trans('backend::lang.form.close')) ?>
22-
</a>
23-
</div>
24-
<?php else: ?>
25-
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
26-
<p>
27-
<a href="<?= Backend::url('renatio/dynamicpdf/templates/index/layouts') ?>"
28-
class="btn btn-default">
29-
<?= e(trans('renatio.dynamicpdf::lang.layouts.return')) ?>
30-
</a>
31-
</p>
32-
<?php endif ?>
1+
<?php Block::put('breadcrumb') ?>
2+
<ul>
3+
<li>
4+
<a href="<?= Backend::url('renatio/dynamicpdf/templates/index/layouts') ?>">
5+
<?= e(trans('renatio.dynamicpdf::lang.layouts.label')) ?>
6+
</a>
7+
</li>
8+
<li><?= e($this->pageTitle) ?></li>
9+
</ul>
10+
<?php Block::endPut() ?>
11+
12+
<?php if (! $this->fatalError) : ?>
13+
<div class="form-preview" style="display: flex; justify-content: center;">
14+
<iframe src="<?= Backend::url('renatio/dynamicpdf/layouts/html/'.$formModel->id) ?>"
15+
style="width: 793px; height: 1121px; border: 1px solid #9098a2;"></iframe>
16+
</div>
17+
18+
<div class="form-buttons">
19+
<a class="btn btn-default"
20+
href="<?= Backend::url('renatio/dynamicpdf/layouts/update/'.$formModel->id) ?>">
21+
<?= e(trans('backend::lang.form.close')) ?>
22+
</a>
23+
</div>
24+
<?php else: ?>
25+
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
26+
<p>
27+
<a href="<?= Backend::url('renatio/dynamicpdf/templates/index/layouts') ?>"
28+
class="btn btn-default">
29+
<?= e(trans('renatio.dynamicpdf::lang.layouts.return')) ?>
30+
</a>
31+
</p>
32+
<?php endif ?>

0 commit comments

Comments
 (0)