ANARK CORE STATIC PDF TEMPLATE REFERENCE FOR …

[Pages:41]ANARK CORE STATIC PDF TEMPLATE REFERENCE FOR INVENTOR

CONTENTS

Note for Inventor Users .......................................................................................................................................................... 2 Creating Static Tables in a PDF................................................................................................................................................ 3

Table Markup ...................................................................................................................................................................... 3 Overflow.............................................................................................................................................................................. 6 PDF Table Styles .................................................................................................................................................................. 7 Adding Simple Static Text Fields to a PDF ............................................................................................................................. 10 Template Directives .............................................................................................................................................................. 11 Custom Collections ............................................................................................................................................................... 12 MScript Language Reference ................................................................................................................................................ 13 Supported Object Types.................................................................................................................................................... 13 Values / Data Types........................................................................................................................................................... 14 Operators .......................................................................................................................................................................... 15 Chaining / Property Operators.......................................................................................................................................... 20 Grouping ........................................................................................................................................................................... 21 Non-contextual Functions................................................................................................................................................. 22 String Functions ................................................................................................................................................................ 24 Array Functions ................................................................................................................................................................. 27 Image Functions ................................................................................................................................................................ 30 Object Graph Functions .................................................................................................................................................... 31 Regular Expression Functions ........................................................................................................................................... 32 Arrow Functions................................................................................................................................................................ 33 Regular Expressions .......................................................................................................................................................... 34 Data Integrity/Validation .................................................................................................................................................. 35 Special Variables ............................................................................................................................................................... 35 Cookbook .............................................................................................................................................................................. 37

NOTE FOR INVENTOR USERS

This document refers to "attributes" in many places. This corresponds to Autodesk Inventor "properties". To use these properties, just use the name of the property as you see it in the Export 3D PDF dialog:

CREATING STATIC TABLES IN A PDF

PDF templates can be set up to produce tables that are published as static (printable) text. To design a table, start Adobe Acrobat, go to Tools, and select Prepare Form. Create a new text field or edit an existing text field. Then add simple markup to the text field to specify the data and style the table.

Under "Text Field Properties", go to the Options tab and make sure the "Multi-line" option is checked. Then add the table markup to the "Default Value" box. For larger tables, it's usually easier to use an external text editor to create the table markup, and then paste it into the "Default Value" box.

Set the text field size to the desired output size of the table. Make sure your table does not overflow horizontally (ensure the columns fit in the space you have allocated). If the table overflows vertically, extra pages will be added to the PDF to contain the overflow data (see Overflow). If the table has column headers, the column headers will be repeated on the overflow pages.

TABLE MARKUP

The table markup uses the pipe character (|) to delimit table columns. Table headers and data rows are specified on separate lines. Table headers are optional, and it is possible to specify many data rows. Each table cell can specify a style. Table headers consist of regular text, followed by STYLE="" - no curly braces {{{}}} are allowed for table headers. The templated data rows must contain all cell content in curly braces {{{}}}. To output a regular text string, you can use the expression {{{ 'your text goes here' }}}, but typically object types and attributes will be referenced in your expressions. If there is only one column in your table, make sure you specify STYLE="..." or else your markup will be treated as a simple field.

Here is an example table template:

Component Name STYLE="width: 70%;" | Quantity STYLE="width: 30%;"

{{{ component.Name }}}

| {{{ component['Use Count'] }}}

Output:

This table template has 2 columns. There is a column header with the column names 'Component Name' and 'Quantity'. There is one templated data row that will produce output rows containing all component names and the total number of each component. The font color, background color, and line style are all specified by the properties of the text box itself. The column widths are specified by the STYLE in the column headers.

Let's add some more styling. First, start with the text box properties:

Then we will add an alternating background color to the data rows:

Component Name STYLE="width: 70%;" | Quantity STYLE="width: 30%;" {{{ component.Name }}} STYLE="font-weight: normal; color: black; background-color: white;" | {{{ component['Use Count'] }}}

Note that once a style setting has been set, it will remain in use for the following table cells until it is changed. It is also possible to specify styles that are data dependent. This allows for styling of data that matches a certain pattern. Let's add an alternating background color:

Component Name STYLE="width: 70%;" | Quantity STYLE="width: 30%;" {{{ component.Name }}} STYLE="{{{ /\./.exec(RECORD_NUMBER / 2) ? 'font-weight: normal; color: black; background-color: white;' : 'font-weight: normal; color: black; background-color: lightyellow;' }}}" | {{{ component['Use Count'] }}}

In the above example, notice that the style contains the same type of expression used in the table cells. See PDF Table Styles and MScript Language Reference for more details.

Multiple Header Rows

Multiple header rows can be added to the table template. This can be useful for specifying a table title above the column headers. All headers rows will be repeated on overflow pages.

This is my table title STYLE="column-span: all;"

| STYLE="column-span: none;"

Column Header 1 STYLE="width: 50%;"

| Column Header 2 STYLE="width: 50%;"

{{{ 'Data cell 1' }}} STYLE="background-color: white;" | {{{ 'Data cell 2' }}}

Multiple Templated Data Rows Multiple data rows can be added to the table template and the results will be concatenated together.

In this example, a table is created by combining the component data in the CAD model with view data in the CAD model. There is one header row and two templated data rows. This will result in a single table with two columns, and the number of rows will be equal to the sum of all components plus the number of views:

Name {{{ component.Name }}} {{{ view.Name }}}

| Quantity | {{{ component['Use Count'] }}} | {{{ '1' }}}

Conditionally Including or Excluding Tables

If desired, tables can be included or excluded in exported PDFs according to the value of an MScript expression. This allows the same template to be used with more than one set of data.

To use this feature, the first line of the table template must look like this:

INCLUDE="{{{ your conditional expression goes here }}}"

The expression will be interpreted as a "true" or "false" value. When the value is true, the table will be included. When the value is false, the table will not be included in the PDF.

Here is the complete markup for a table that will only be included when the top level component is named "XYZ":

INCLUDE="{{{ topComponent.Name == 'XYZ' }}}"

Column Header 1

| Column Header 2

{{{ component.Name }}} | {{{ component['Revision Number'] }}}

OVERFLOW

When the content of a table grows longer than the area allotted for the table, the table will "overflow" onto following pages. All other page content (images, form fields, static fields) will be copied onto those following pages except for other table templates that do not have overflowing content. Horizontal overflow (when the columns do not fit in the width of the field) is not supported. When column headers are specified, the header row will be repeated on the overflow pages.

Overflow of Form Fields Form fields that are copied to overflow pages have numbers appended to the end of their names in order to keep the names unique. This can sometimes cause problems if the template contains JavaScript code that references those field names. For example, if a field is named "MyField" and a table on the same page overflows, then that field will be copied to the overflow page with the name "MyField(2)". The page that contains the 3D viewer usually contains JavaScript for interactivity, so overflowing content on that page will typically cause some problems. It's best to put any tables that might overflow on a separate page, not the 3D page or other pages with interactive controls. If you need a table to fit within a certain space and never overflow regardless of the amount of data, then that can be accomplished using a scrollable List Box control that is filled with data using JavaScript in the template, rather than with a static table template.

Copy Tables to Overflow Pages If there is a need to force a table to be copied onto overflow pages that are created for another table, the text "COPY_WITH_OVERFLOW" can be added after the field name:

PDF TABLE STYLES

Best practice: Use the text field's properties to set as much of the table style as possible- this will reduce the amount of styling required in the table cell markup.

Important note: Single-column tables will only be recognized as tables if they contain a STYLE. Otherwise they will be treated as simple text fields.

Properties: The following properties are available for use with table styles. Note that data-driven styles (that is an MScript expression within the STYLE directive) are only supported on data rows, not the header row.

border-spacing

The border-spacing property specifies the distance between the borders of adjacent cells. It can only be specified in the header row or the first data row when there are no headers. The value is a number. Example: border-spacing: 10;

padding

The padding property sets the cell padding (the space between the border and the cell contents). The value is 1 to 4 numbers. A single number specifies the padding on all sides. Specifying multiple numbers specifies the padding on the top, right, bottom, and left, in that order. Examples:

padding: 10; padding: 10 20 30 40;

padding-left padding-right padding-top padding-bottom

The padding- properties set the cell padding (the space between the border and the cell contents) on a specific side of the cell. The value a number. Example: padding-left: 10;

width

The width property specifies the width of the table columns. It can only be specified in the header row or the first data row when there are no headers. The value is a number or a percentage. It is generally recommended to use a percentage. Examples:

width: 50; width: 25%;

height

The height property specifies the height of table rows. This is generally not needed or recommended because table row height will be automatically adjusted to fit the content of the row. The value is a number. Example: height: 20;

color

The color property describes the foreground/font color of the cell text. The value is a color name or a standard HTML RGB color value. The default value is set via the respective template text field property. Examples:

color: red; color: #fff; color: #ff10b0;

background-color

The background-color property sets the background color of the table cell. The value is a color name or a standard HTML RGB color value. The default value is set via the respective template text field property. Examples:

background-color: red; background-color: #fff; background-color: #ff10b0;

text-align

The text-align property describes how to align the cell contents horizontally within a table cell. The value is one of the following: left, right, center, justify. The default value is set via the respective template text field property. Example: text-align: center;

vertical-align

The vertical-align property describes how to align the cell contents vertically within a table cell. The value is one of the following: top, middle, bottom. The default value is top. Example: vertical-align: middle;

font-weight

The font-weight property selects the weight of the font. This property only works with the "standard" fonts (helvetica, courier, and times). The value is one of the following: normal, bold Example: font-weight: normal;

font-size

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download