Skip to content

pdf page templates

Narayana Swamy edited this page May 4, 2024 · 1 revision

i-page-template

The i-page-template element in the pdfFrame syntax is a powerful and flexible component for defining reusable page layouts and styles. It's a key feature for managing consistent designs across multiple pages within a PDF document.

Definition and Usage

The i-page-template element allows you to create a template with predefined styles, layouts, and components that can be applied to individual pages using the p-template attribute. Pages within the PDF can reference the template by its unique ID using the p-template attribute. This creates a connection between the page and the template, ensuring that the layout and styles are applied.

Attributes

  • id: Uniquely identifies the template, enabling it to be referenced by pages.

Example

<i-page-template id="temp-1">
    <i-rect :x="0" :y="0" :width="595" :height="841" :style="{ fillStyle:'#ffffff' }"></i-rect>
    <i-text :x="30" :y="30" :text="'Header Text'" :width="530" :style="{font: '15px Arial'}"></i-text>
    <i-text :x="30" :y="810" :text="'Footer Text'" :width="530" :style="{font: '15px Arial'}"></i-text>
</i-page-template>

#PDF Page
<i-page p-template="temp-1"></i-page>

By defining a page template, you can ensure that multiple pages have the same themes, such as headers, footers, and background styles. This ensures consistency across the document. Using a common template makes it easier to manage and update the design. Changes made to the template are automatically reflected across all pages that reference it.

It reduces duplication and redundancy in code by providing a single source for common elements.

Clone this wiki locally