Skip To Content

INTEGRAL

INTEGRAL DSL Reference Guide

Jump directly to: 

::my.app.ExportToFile(filename, filetype, width, height, additional_pages = 0, page = DX_PAGE_CURR, transp = DX_TRANSP_NO, quality = 75, anim_delay = 50, anim_loops = 0)

::my.app.Export(filetype, width, height, additional_pages = 0, page = DX_PAGE_CURR, transp = DX_TRANSP_NO, quality = 75, anim_delay = 50, anim_loops = 0)

These functions export one or more pages in the current INTEGRAL document to an output file in the specified format. ExportToFile writes its output to the file specified by the filename parameter while Export writes directly to the INTEGRAL output buffer. The two functions are identical otherwise.

Parameters

filename

A string containing the name (path) of the output file to be created. This path is relative to the current working directory. If a file with the same name already exists, its content is overwritten. This parameter applies only to ExportToFile.

filetype

An integer that defines the format of the output file. It must be one of the following:

Raster (bitmap) image formats that support animation:

Scalable vector graphic formats:

Document formats:

Raster (bitmap) image formats:

width

An integer that defines the width of the exported page(s), in INTEGRAL document units.

height

An integer that defines the height of the exported page(s), in INTEGRAL document units.

additional_pages

An integer that defines what additional pages to export (i.e. pages to follow the page specified by the page parameter) and their order.

However, not all export formats respect this parameter. Export formats that support only one page per output file (e.g. all raster image formats) will ignore this parameter, which means the output will be the same as if additional_pages was set to 0.

page

An integer that defines the first page to export. This must be either a non-negative integer representing a specific page to export or, alternatively, DX_PAGE_CURR which means the current page.

transp

An integer that defines the transparency setting of the background. It must be one of the following:

This value is respected only with raster image formats; in other cases it is ignored.

quality

An integer that defines the quality level of the export. It must be a value in the 0 - 100 range. 0 is the lowest quality level, 100 is the highest. The value of 75 is recommended for medium to high quality JPEGs. For GIFs, quality levels over 75 utilize dithering (and result in a lower export speed). This value is respected only with lossy compression formats such as GIF or JPEG; in other cases it is ignored.

anim_delay

A non-negative integer that defines the animation delay between pages (which are treated as animation frames), in 1/100 seconds. This value is respected only with export formats that support animation, such as GIF or APNG; in other cases it is ignored.

anim_loops

A non-negative integer that indicates the number of times that the animation should play; if 0, the animation should play indefinitely. If positive, the animation should stop on the final frame, at the end of the last loop. This value is respected only with export formats that support animation, such as GIF or APNG; in other cases it is ignored.

Return Value

Both functions return DV_RET_OK on success and DV_RET_ERR on failure.

Notes

Both functions can be called multiple times during a web session. However, it makes sense to call Export only once. This is because each call to Export overwrites the contents of the INTEGRAL output buffer. This means that only the most recently generated file stays in the output buffer. Also, once Export is called, the buffer output mode is set to binary; any subsequent calls to Print or any other function that writes to the output buffer in text mode will fail.

Example 1

::my.app.ExportToFile("private/document.pdf", DX_FORMAT_PDF, 1000, 1800, 1, 0);

Example 2

::my.app.Export(DX_FORMAT_PDF, 1000, 1800, -2, 4);

Example 3

::my.app.Export(DX_FORMAT_GIF, 400, 200, 8, 0, DX_TRANSP_ALPHA, 50, 100, 3);

Example 4

::my.app.SetHeaders("Content-Disposition: attachment; filename=\"animation.gif\"\r\n");
::my.app.Export(DX_FORMAT_GIF, 400, 200, 8, 0, DX_TRANSP_ALPHA, 50, 100, 3);

Example 5

::my.app.ExportToFile("private/animation.gif", DX_FORMAT_GIF, 400, 200, 8, 0, DX_TRANSP_ALPHA, 50, 100, 3);

Example 6

::my.app.SetHeaders("Content-Language: fr\r\nContent-Disposition: attachment; filename=\"fichier_2149.pdf\"\r\n");
::my.app.ExportToFile("storage/fichier_2149.pdf", DX_FORMAT_PDF, 1000, 1800, 10);
::my.app.Write("storage/fichier_2149.pdf");