Version: 4.1.0 +
Object Type: Action Object
The Download object is used to offer the possibility to download any file format from a website. Unlike the DocConverter the Download can only be executed in a website, not in the Editor.
BrowserAction indicates how the browser should handle the download. Its values are Open or Download, where Open will open the document in the browser, and Download will download the file.
This property indicates under which condition the Download is to be executed. If nothing is entered the Download will always be executed. If a condition has been filled in, the Download will only be executed if the Condition is 'True'. The condition can be a Fixed, a Formula or a Reference to another object of type Boolean.
The contenttype is the HTTP MIME type of the output stream. The MIME indicates the nature and format of a file on the internet. The default value is "text/html". The most common are listed below.
- Plain text: text/plain
- PDF: application/pdf
- Excel-document: application/vnd.ms-excel
- Word-document: application/msword
For a list of all possible types see for example the link given in External Topics.
DebugLogMode (from version 4.1)
Indicates the level of detail of debug information that is logged when running a Futurama application (website, webservice, console application) to the trace, a logfile, a database etc. The possible values are:
- None: no debug information is logged
- Simple: only basic information is given
- Extended: in addition to the information in the Simple mode the values of all the properties of the object are shown
The property FileName contains the name of the file after the download. Make sure the correct extension is used.
Possible values are True or False. If the value is False, then the object can only be used within the document where it is created. If the value is True, then also from other Futurama documents can be referred to this object. This means that changes in the object also affect the document in which is referred to this object. If the value is True and you attempt to move or delete the object, a warning will be given. To limit these warnings to a minimum it is recommended to set IsPublic to True only when necessary.
OpenMode (obsolete: Renamed into BrowserAction in version 18.02)
This property can have the values 'OpenInBrowser' or 'OpenAsAttachment'. When 'OpenInBrowser' is chosen the file will be opened directly in a new window of the browser. When 'OpenAsAttachment' is chosen the file will be opened in the application that is associated with the extension of the file.
The source represents the contents of the file that is downloaded. In particular this property has to refer to a Base64 string. Any string can be converted to a Base64 string by using the function ConvertToBase64. Any fileformat can be converted to a Base64 string by using the function ReadFileAsBase64.
The name of the object.
Here a comment can be entered. For example a short description of the object.
The unique identification number of the object. This number is automatically generated by Futurama on the moment of creation. This number can be used when searching for a certain object in the Find Window.
In this example it is shown how a Word document as well as an HTML document can be downloaded from a website.
Download the files used for the download_example.
- For this example you need an installed and working version of Futurama Web (Version 4.1.2 or later).
- Copy the directory Download in the zip-file to this Futurama directory.
- Open the XML document calc.xml in the Futurama Editor of the same version as Futurama Web.
- The document contains a string 'Text' containing a sample text "This text was generated by the Download object." and a Formula 'Text (Base64)' which converts the text into a Base64 string. Both can be verified in the Result window although the latter will not be readable.
- Two buttons can be seen which both contain an Action in which a Download object is placed.
- The first Download will open a Word document containing the string. This can be seen from the ContentType='text/plain' combined with the filename.
- The second Download will open an HTML file containing the same string. This can be seen from the ContentType="text/html" combined with the filename.
- By running the 'application' in your browser and pressing both buttons it can be verified that a Word document as well as an HTML document is opened containing the text 'This text was generated by the Download object.'