diff --git a/README.md b/README.md index c7d6736..96f74f0 100644 --- a/README.md +++ b/README.md @@ -102,5 +102,5 @@ class PdfAttachment extends AttachPdf Contributions and discussions are always welcome, no matter how large or small. If you happen to find an issue, please open up a Github issue or do a PR if you can. -[^1]: The addon required Browserhot for the PDF attachment to work out of the box. Please note that the addon will not install Browsershot for you as you might have already installed some version of it. Please install Browsershot directly into your project. +[^1]: The addon requires Browserhot for the PDF attachment to work out of the box. Please note that the addon will not install Browsershot for you as you might have already installed some version of it. Please install Browsershot directly into your project. [^2]: Refer to the offical [Laravel documentation](https://laravel.com/docs/mail#attachments) on how to create attachments in various ways. diff --git a/config/statamic-formattach.php b/config/statamic-formattach.php index 1811c71..7e76680 100644 --- a/config/statamic-formattach.php +++ b/config/statamic-formattach.php @@ -38,6 +38,17 @@ 'A6' => ['105mm', '148mm'], ], + /** + * The margins applied to PDF pages. + */ + 'margins' => [ + 'top' => 10, + 'right' => 15, + 'bottom' => 15, + 'left' => 10, + 'unit' => 'mm', + ], + 'forms' => [ 'form_handle' => [ // \SchantlDev\Statamic\FormAttach\Attachments\AttachPdf::class, diff --git a/resources/views/pdf_attachment.antlers.html b/resources/views/pdf_attachment.antlers.html index 04fe786..b53b6f7 100644 --- a/resources/views/pdf_attachment.antlers.html +++ b/resources/views/pdf_attachment.antlers.html @@ -18,6 +18,13 @@ padding: 0; } + .preview-margins { + padding-top: {{ config:statamic-formattach:margins:top ?? 10 }}{{ config:statamic-formattach:margins:unit ?? 'mm' }}; + padding-right: {{ config:statamic-formattach:margins:right ?? 15 }}{{ config:statamic-formattach:margins:unit ?? 'mm' }}; + padding-bottom: {{ config:statamic-formattach:margins:bottom ?? 10 }}{{ config:statamic-formattach:margins:unit ?? 'mm' }}; + padding-left: {{ config:statamic-formattach:margins:left ?? 15 }}{{ config:statamic-formattach:margins:unit ?? 'mm' }}; + } + {{ partial src="statamic-formattach::pdf_styles" }} @@ -25,47 +32,45 @@ {{ if preview }}
+ {{ value }}
+
+ {{ (label ?? value) | nl2br }}
+ {{ !last ?= '
' }}
+ {{ /value }}
+
{{ (value:label ?? value) | nl2br }}
+ {{ /if }}
- {{ value }}
-
- {{ (label ?? value) | nl2br }}
- {{ !last ?= '
' }}
- {{ /value }}
-
{{ (value:label ?? value) | nl2br }}
- {{ /if }} -