Asset Functions

Asset functions include:

IsAssetExist

The IsAssetExist function checks if the asset exists. Returns true if it exists, otherwise returns false.

Syntax:

IsAssetExist(AssetIdAsString, mediaTypeNumber)

The mediaTypeNumber parameter is optional. The default value is 8.

Asset (media) types include:

  • 3 - for web graphics (graphics valid for web, such as .jpg)

  • 6 - for web text

  • 7 - for print text

  • 8 - for print graphics, such as .pdf (default value)

Example:

IsAssetExist("Pic1", 3) = True

GetAssetPath

The GetAssetPath function returns the file path of the asset. If none is found, returns null.

Syntax:

GetAssetPath(AssetIdAsString, mediaTypeNumber)

Asset (media) types include:

  • 3 - for web graphics (graphics valid for web, such as .jpg)

  • 6 - for web text

  • 7 - for print text

  • 8 - for print graphics (such as .pdf)

Example:

GetAssetPath("Pic1", 3) = C:\\Pic1.png

GetAssetPath("Pic1", 8) = C:\\Pic1.pdf

GetAssetWebURL

The GetAssetWebURL function returns the asset's web URL. If none is found, returns null.

Syntax:

GetAssetWebURL(AssetIdAsString, mediaTypeNumber)

Asset (media) types include:

  • 3 - for web graphics (graphics valid for web, such as .jpg)

  • 6 - for web text

  • 7 - for print text

  • 8 - for print graphics (such as .pdf)

Example:

GetAssetWebURL("Pic1", 3) = https://www.xmpie.com/wp-content/Pic1.png

GetAssetWebURL("Pic1", 8) = https://www.xmpie.com/wp-content/Pic1.pdf

GetPDFAssetPageCount

The GetPDFAssetPageCount function returns the PDF's number of pages. If a PDF is not found, returns 0.

Syntax:

GetPDFAssetPageCount(assetIdAsString)

Example:

GetPDFAssetPageCount("Doc1") = 6

Rectangle

This function can be used to fill any shape created within InDesign (for example a circle, a polygon, etc.).

The Rectangle function generates on-the-fly a dynamic rectangle (graphic image) in the required color (CMYK).

Using this function you can set dynamic object colors using variables and campaign dials that can be used in uStore products.

Click here to learn how to create a dynamic color picker in uStore using the Rectangle function.

Syntax

Rectangle(cyanPercentage, magentaPercentage, yellowPercentage, blackPercentage)

Example

Rectangle(12, 87, 71, 3) = Flame Scarlet

Rectangle(88, 67, 20, 5) = Classic Blue

Web.URLContentAsFile

TheWeb.URLContentAsFilefunction gets an image from the internet via its URL.

See Video training

Syntax

CallWeb.URLContentAsFile(URL, timeout, defaultAssetName, contentType)

  • URL: Required. The URL to an image, e.g. http://imagesdomain/imagesfolder/imagename.jpg

  • timeout - (Optional) The default is 30 seconds, after which the request is timed out.

  • defaultAssetName - (Optional) Default asset in case of error (including time out). If no asset is defined, the error will be handled as a missing asset.

  • contentType - (Optional) By default it is automatically detected. You can explicitly define a IANA mime type.

Example

Web.URLContentAsFile("http://imagesdomain/imagesfolder/imagename.jpg")

PDFAssetPagesTable function

The PDFAssetPagesTable function generates a table with rows corresponding to each page of the input PDF, allowing users to easily populate a table with PDF pages, eliminating the need for JavaScript and manual looping.

This function is particularly useful for customers who receive PDFs from external sources and need to print them with added information, such as addresses, page numbering or water marks.

Syntax

PDFAssetPagesTable(assetIdAsString)

The function should be used in the Table ADOR expression.

The Table ADOR should be created with one graphic column of any name.

assetIdAsString can be a static string, variable or recipient data field that contains the name of a PDF file that is available in the Assets folder.

Example

PDFAssetPagesTable("Pages.pdf")

If "Pages.pdf" is a three page PDF in the asset folder, the table created would contain three rows:

Pages.pdf:1

Pages.pdf:2

Pages.pdf:3

For more information, refer to this video: Using the PDFAssetPagesTable function