AX1762
Configuring a Formatted Grid component for printing to PDF
If you intend for users to print an Axiom form that contains a Formatted Grid component, you should configure the grid as appropriate so that its contents are fully viewable in the PDF output. Some common considerations include:
- Fitting all columns in the PDF page
- Extending the grid to multiple pages when the rows do not fit on a single page
- Repeating header rows when rows span multiple pages
- Hiding inapplicable content
The page size and orientation of the PDF impact how many columns and rows can fit in the PDF pages. For more information on configuring these form-level PDF settings, see Configuring an Axiom form for printing to PDF.
NOTE: The options discussed in this topic only apply when using Axiom Software functionality to generate a PDF of the form for printing. When using the native print functionality of your browser, Axiom Software cannot control the output.
Setting grid column width for PDF printing
If the column widths of a Formatted Grid component exceed the width of the PDF page, then the excess content is not shown in the PDF. In order to display all columns in the PDF, you should set the column widths so that all columns fit within the page. This can be achieved as follows:
-
Use percentage widths instead of setting the width in pixels. This approach ensures that all columns will fit on the page (assuming percentages do not exceed 100%), but it does not ensure that all columns will be readable. Percentage column widths that work fine in the browser may not provide enough room for the contents when the percentage is calculated against the width of the PDF page. You should test the output to verify that the percentage column widths will work in the PDF.
OR
- Set precise column widths that are tested in the PDF output. After configuring the form-level size and orientation for the PDF, you can determine the appropriate column widths through trial and error.
In some cases, the desired column widths for presentation in the browser will not also work for printing to PDF. You can use a dedicated tag in the FormattedGrid data source to set different column widths only for use when generating a PDF: [PDFColumnWidth]
. The data source wizard does not add this tag when you create a Grid data source, so you must manually add it. The tag can be placed anywhere in the control column, however the most typical location is either above or below the [ColumnWidth]
tag.
Example data source with tag to control column widths in PDF
The [PDFColumnWidth]
row can use the same entries as the [ColumnWidth]
row—width in pixels, width in percentage, and width ranges. For more information on valid column width values, see Setting column sizes for Formatted Grids. If the [PDFColumnWidth]
row is not present in the data source, or if it is present but it is blank for a particular column, then the value in the [ColumnWidth]
row is used.
NOTE: Remember to set the form-level PDF orientation as appropriate for the width of the Formatted Grid component. Many grids require landscape orientation in order to display all columns within the PDF. For more information on configuring the form-level PDF settings, see Configuring an Axiom form for printing to PDF.
Configuring page breaks for PDF printing by setting rows per page
If you have a grid where you expect the rows to span multiple pages, you can control the number of rows per page and optionally repeat header rows on each page. To do this, use the PDF Settings button in the Form Assistant task pane or the Form Designer dialog.
NOTE: The grid-specific PDF settings are only supported for use with the following skins: Axiom and Axiom2018. These settings are ignored when using any other skin.
Clicking this button opens the PDF Settings dialog, where you can complete the following settings:
Item | Description |
---|---|
Rows Per Page |
Defines the number of rows to display on each PDF page. For example, you can enter 50 to show 50 rows per page. Axiom Software automatically applies a page break after each configured set of rows. The number of rows that can fit on a page depends on various factors, such as row height, page size, page orientation, and page margins. This option does not scale the rows to fit on the page. If the specified number of rows cannot fit on the page, then the rows extend to the next page and then the page break is applied. By default, this setting is 0, which means rows per page is not configured and the default grid behavior applies instead. |
Row Limit for First Page |
Defines the number of rows to display on the first PDF page. This setting can only be configured if Rows Per Page is greater than 0. It allows you to override the rows per page for the first page only, to accommodate form titles and other content that only display on the first page. By default, this setting is 0, which means that the Rows Per Page setting is used for all pages. |
Repeat Headers |
Specifies whether header rows repeat on each PDF page, when the rows in the grid span multiple pages. This setting can only be configured if Rows Per Page is greater than 0. By default, this setting is disabled, which means header rows do not repeat. If enabled, then all rows in the Grid data source that are flagged with |
Example PDF Settings dialog for Formatted Grid components
When you click OK in the PDF Settings dialog, the values are written back to the corresponding fields for the Formatted Grid component in the Form Control Sheet. If needed, you can edit the fields in the Form Control Sheet directly rather than using the dialog. You may need to do this in cases where you want to use a formula to drive the value for a setting. If you are using an older form where the Form Control Sheet does not contain these fields, then you must use the dialog once to define values for the settings, which automatically adds the fields to the Form Control Sheet.
When Rows Per Page is greater than 0, the Extended Height option is automatically applied when generating a PDF. This option allows the grid to dynamically extend to show all rows. This means that no other components can be placed below the grid, because the grid will extend underneath those components (see the following section for more information).
If Rows Per Page is not configured (blank or 0), and Extended Height is not separately enabled, then the grid rows in the PDF will not span multiple pages. Any rows that exceed the height of the component (as limited by the PDF page) do not display.
Using Extended Height without Rows Per Page
If desired, you can use the Extended Height option separately, without configuring Rows Per Page. This option dynamically adjusts the height of the grid as needed to display all rows in the PDF.
In most cases you would use a formula to dynamically enable Extended Height only when generating a PDF. When a user creates a PDF of an Axiom form, the Is PDF setting on the Control Sheet is changed to On, and then the form is calculated before the PDF is generated. The Extended Height setting could use a formula such as the following:
=IF(Control_Form!D22="On","On","Off")
In this example, Control_Form!D22 is the location of the Is PDF setting. Extended Height is disabled when users view the form online (Is PDF is Off). But when the form is converted to a PDF (Is PDF is On), then Extended Height is enabled so that all rows display in the PDF document.
If Extended Height is enabled, no other components can be placed below the formatted grid on the form canvas. The extended grid will not "push" the other components down; instead the other components will continue to display at their location on the canvas and the formatted grid will extend underneath the other components. There is one exception to this behavior—if a grid with extended height is placed within a flow panel, the placement of the other components in the flow panel will adjust for the extended height. However, note that the height of the panel itself does not adjust (even if set to dock), so the Overflow property of the panel cannot be set to Hidden.
NOTE: When using Extended Height without Rows Per Page, it is not possible to repeat header rows because Axiom Software does not know where the PDF page breaks are located. When using Rows Per Page, the page break locations are known and therefore header rows can be repeated.
Hiding inapplicable content for PDF printing
The Formatted Grid component may contain content that is not necessary to include in the PDF. For example, if the grid shows a list of departments, there might be a column in the grid that contains a hyperlink to open a corresponding plan file for that department. This column is not necessary to show in the PDF, because the hyperlink will no longer be live. You might choose to hide the column when printing to PDF, so that there is more room to display other columns with relevant information.
When a user creates a PDF of an Axiom form, the Is PDF setting on the Control Sheet is changed to On, and then the form is calculated before the PDF is generated. You can use a formula to hide or show the [Column]
tag of a particular column, to exclude that column from the PDF.