diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f370541..153f3f27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ https://github.com/anvilistas/anvil-extras/pull/121 * storage - update and clear were missing from the documented api https://github.com/anvilistas/anvil-extras/pull/125 +* PageBreak - fix margin_top property and make it optional + https://github.com/anvilistas/anvil-extras/pull/137 ## Updates * Slider Component - bump javascript dependency and refactor. No changes to the component's public API. diff --git a/client_code/PageBreak/__init__.py b/client_code/PageBreak/__init__.py index ea4e6844..5cabf103 100644 --- a/client_code/PageBreak/__init__.py +++ b/client_code/PageBreak/__init__.py @@ -13,7 +13,7 @@ class PageBreak(PageBreakTemplate): - def __init__(self, margin_top, **properties): + def __init__(self, margin_top=0, **properties): self.margin_node = _S(anvil.js.get_dom_node(self)).find(".margin-element") self.margin_top = margin_top self.init_components(**properties) diff --git a/client_code/PageBreak/form_template.yaml b/client_code/PageBreak/form_template.yaml index 613517f5..01ce44b8 100644 --- a/client_code/PageBreak/form_template.yaml +++ b/client_code/PageBreak/form_template.yaml @@ -3,11 +3,12 @@ container: properties: {tooltip: '', background: '', foreground: '', border: '', visible: true, role: null, html: "\n
\n
\n
\n
\n\n\ - "} + page-break-after:always;\"/>\n
\n
\n\n"} components: [] is_package: true custom_component: true properties: -- {name: margin_top, type: number, default_value: 0, default_binding_prop: true} +- {name: margin_top, type: number, default_value: 0, default_binding_prop: true, description: Use to adjust whitespace at the top of each page in the generated pdf. This is an optional property and defaults to 0. Can be positive or negative. Negative numbers will reduce whitespace in the generated pdf.} diff --git a/docs/guides/components/page_break.rst b/docs/guides/components/page_break.rst index 33aafdd8..7d28fa3e 100644 --- a/docs/guides/components/page_break.rst +++ b/docs/guides/components/page_break.rst @@ -1,3 +1,7 @@ PageBreak ========= For use in forms which are rendered to PDF to indicate that a page break is required. + +The ``margin_top`` property is optional. In the generated pdf you may want more or less white space at the top of the page. +You can set the ``margin_top`` property to a positive/negative number to adjust the whitespace. +Most of the time this is unnecessary. This won't have any effect on the designer only the generated pdf.