1. What Does This Page Cover?
Learn how you can customize the output PDF when you download a
page from the live mode of your application.
2. Availability
- Pages are available in all plans of Creator.
- Only the super admin, admins, and developers can create and manage pages.
3. Customization While Exporting a Page as PDF
In Zoho Creator, you can choose to allow the
download of a page as a PDF from the live mode of the application. This is done by enabling the
PDF option under the
Page Properties pane in the edit mode, after which the
PDF button will be enabled in the live mode.
You can format the basic attributes of the PDF that will be downloaded beforehand, such as setting page margins, customizing the header and footer, displaying page numbers, and so on. These customizations need to be incorporated inside
HTML snippets inserted in the page for them to show on its downloaded PDF copy.
The output PDF file with such basic formatting is shown in the below video:
3.1. PDF Margin
Syntax
zcpage-spacing="pixelvalue"
Syntax Description
To set custom page margins in the first <div> tag of the body. A sample code snippet is shown below.
- <body>
- <div zcpage-spacing="40">
- </div>
- </body>
Note: By default, the PDF will be rendered with 0px as margin value on all sides.
To add and repeat header or footer content in the output PDF, add zcpage-headerhtml="true" and zcpage-footerhtml="true" respectively, as an attribute in the required <div> tag. Sample code snippets are shown below.
Header:
- <div zcpage-headerhtml="true"><div class="align-center" style="text-align: center;">
- Zylker Employee Management
- </div>
Footer:
- <div zcpage-footerhtml="true"><div class="align-center" style="text-align: center;">
- Copyright 2024 @Zylker Technologies Pvt Ltd. All Rights Reserved.
- </div>
- Avoid using the header and footer attributes in table elements and fixed-position elements to ensure there is no break in consistency in the output PDF.
- The height of the header and footer attributes should be less than 300px.
- External style sheets and inherited style properties will not be applied to the header and footer HTML elements. We suggest you use the Inline style.
- If header/footer attributes are specified for more than one HTML element, the attributes specified will be rendered only for the first HTML element.
- For an HTML element, you can specify either the header or the footer. If you specify both, only its header will be rendered.
- Using style elements like margin-top, margin-bottom, padding-top, padding-bottom inside the header/footer element tends to break the header/footer.
Note: Consider using the top/bottom margin values mentioned below for the header/footer in the respective HTML elements:
- zcpage-headerspacing-top="pixelvalue"
- zcpage-headerspacing-bottom="pixelvalue"
- zcpage-footerspacing-top="pixelvalue"
- zcpage-footerspacing-bottom="pixelvalue"
3.3. Page Number
Syntax
-
To show the current page number, add:
<div class="zcpage-pagenumber"> <span class="currentPageNumber"> </span> </div>
-
To show the total number of pages, add:
<div class="zcpage-pagenumber"> <span class="totalPageNumber"> </span> </div>
Syntax Description
The
zc_PageNumber parameter in the
exported page's URL will not work when the footer content is specified. In such cases, you can show the page number by adding the above syntax in either the header or the footer's HTML.
For example, this HTML code will cause to display 1 of n, 2 of n,.... n of n, in the footer of the respective pages of the PDF:
- <div zcpage-footerhtml="true">
- <!-- your footer content -->
- <div class="zcpage-pagenumber">
- <span class="currentPageNumber"> </span> of <span class="totalPageNumber"> </span></div>
- </div>
4. Points to Note
- If any of the above customizations are mentioned in more than one HTML element, the output PDF will be customized based on the first HTML element in the snippet. For example: