Configuring Page Numbers and Margins
The locally generated Output Documents on iOS and Android devices use the mobile device’s native browser to convert the HTML to PDF. The specific rendering is a result of the native browser’s capabilities, Safari for iOS and Chrome for Android. Custom functionality is added to ServiceMax Go output document generation to ensure page margins and page numbers can be displayed on output documents generated on iOS and Android devices.
Page Margins on iOS Devices
On iOS devices, the “@page” CSS rule cannot be used to specify margins in output documents because Safari does not support the “@page” CSS rule. An option is available to specify a span element with an id "svmxgo-ios-margin" in the Output Document template.
To configure margins on the output document template for iOS devices:
1. Append the following code to the Output Document template:
<span id="svmxgo-ios-margin" style="display:none" svmx-data="padding-left:<number>;padding-right:<number>;padding-bottom:<number>;padding-top:<number>">margin</span>
2. Save the template. Example:
<span id="svmxgo-ios-margin" style="display:none"
svmx-data="padding-left:20;padding-right:20;padding-bottom:20;padding-top:40">margin</span>
Page Margin on Android Devices
On Android devices, the “@page” CSS rule can be used to specify margins in output documents.
Example: @page{margin: 2cm}
* 
Unit in centimeters is an example. You can use any CSS unit.
Page Numbers
An option is available for iOS and Android devices to specify a span element with an id "svmxgo-page-number" in the Output Document template.
The different elements of the page number span id are described in the following table:
Elements of the span id
Description
position
The positioning of the page numbers. Values: top-left, top-right, bottom-left, bottom-right
margin-horizontal
The spacing from the left and right sides of the page
margin-vertical
The spacing from the top and bottom of the page
To configure page numbers on the output document template
1. Append the following code to the Output Document template.
<span id="svmxgo-page-number" style="display:none" svmx-data="position:top-left;margin-horizontal:<number>;margin-vertical:<number>">page number</span>
2. Save the template. Example:
<span id="svmxgo-page-number" style="display:none"
svmx-data="position:top-left;margin-horizontal:20;margin-vertical:20">page number</span>
Page numbers are displayed as current page and total number of pages separated by a slash such as 3/8. The page number format is not customizable such as "Page x of x". The format is always x/x.
Key Considerations
The custom page margin span id is applicable to output documents generated on iOS devices only. They do not have an effect on PDF documents generated on an Android device or on the server.
The content between the opening and closing span tags (the word ‘margin’ in the "svmxgo-ios-margin" example, and the words ‘page number’ in the "svmxgo-page-number" example) does not affect the functionality of the span elements and does not appear on the generated output document. The content is only required to ensure that the Output Document Designer does not remove the span HTML element from the template, as the Designer contains functionality to remove span HTML elements that do not contain content.
When using the new span id options, it is important to follow the examples given, with changes only for specific desired number values and options as explained. Adding any other CSS properties other than the one explained prevents the new span id options from working.
All numbers used for the svmx-data property values should be plain numbers, and all units are “pt” (points) automatically. Do not manually pass any units to the numbers, such as “pt”, “px”, “em”, and so on.
For customers who were using the "svmxgo-ios-page-number" span id to add page numbers for output documents on iOS devices, that functionality continues to work and applies page numbers to output documents generated on Android devices as well.
Was this helpful?