Products Downloads


French version


 


This function converts a URL (in alphanumeric string form) into an alphanumeric string in Data-URI format (click here fore more details).

The syntax of the returned alphanumeric string is:

data:<media type>;base64,<data> 


with:

  • media type: the MIME type deduced from the URL content analysis,
  • data: series of Base64-encoded numbers.

 

Automatic MIME type deduction starts when the mimeType parameter is not present. It is performed via javax.ImageIO APIs. These natively support the following formats:

  • BMP: Bitmap format (image/bmp MIME type),
  • WBMP: Wireless Bitmap format (image/vnd.wap.wbmp MIME type),
  • PNG: Portable Network Graphics format (image/png MIME type),
  • GIF: Graphics interchange format (image/gif MIME type),
  • JPEG: Joint Photographic Experts Group format (image/jpeg MIME type).

 

To specify an unrecognized MIME type, enter the mimeType parameter with an alphanumeric string representing the MIME type. Click here for more details.

 

Some examples of possible URLs:

  • HTTPS: https://picsum.photos/200/300/?gravity=east,
  • FILE: file:///c:/tmp/logo.png,
  • Relative FILE: file:./resources/logo.jpeg , file:./resources/logo.jpeg. In this case, the directory used is the start directory of the Java application which executes the APE (the Java user directory),
  • JAR FILE: jar:file:///c:/tmp/apesamples-0.0.1-SNAPSHOT.jar!/Training/Hardis_XSL-FO/Resources/Images/xml_feather.gif.


Parameters

String

url

URL pointing to an item of data to convert

Mandatory

String

mimeType

Mime type of the data represented by the URL

Optional

Number

timeout

Maximum timeout value (in milliseconds) used for connecting to and reading URL data.

The possible values are:

< 0: use of Java default values,

= 0: no timeout (unlimited wait),

> 0: set value

Optional.

The default value is "-1".

 


For example

<@hardisFo.foExternalGraphic src=hardisCore.urlToBase64DataURI("https://picsum.photos/200/300/?gravity=east") contentWidth="200px" contentWidth="300px"/>


 

↑ Top of page