|sPath||The local full path name of the file to be loaded to your client|
An encrypted URL that can be used by the client to download (and display) the file
Function DownloadURL String sPath Returns String
|Call:||Get DownloadURL sPath to StringVariable|
DownLoadURL is used to create an encrypted URL that can be used by the web resource manager to download this file to the client. You pass it a local file name and it returns an encrypted URL.
Folders must be registered using RegisterDownloadFolder before files can be downloaded from them.
Object oButton is a cWebButton Set psCaption to "View Prices" Procedure Ok String sPath sUrl Move "C:\Catalog\Pricelist.pdf" to sPath // Builds an encrypted URL based on the file path Get DownloadURL of ghoWebResourceManager sPath to sUrl // load the file in the cWebIFrame object in the frame WebSet psUrl of oFrame to sUrl End_Procedure End_object Object oFrame is a cWebIFrame End_Object
In the above example, the resource manager is used to generate a download URL for the file "c:\Catalog\Pricelist.pdf". The URL is sent back to the client by setting the psURL web property of a cWebIFrame object. Once the IFrame object receives the new psURL property value, it will automatically request this URL from the server. The server will invoke the resource manager to verify the session ID and stream the requested file.
You can set pbDownloadBindSession determine if a download is bound to a session and piDownloadTimeout to set a timeout for the URL.
If you need more control over your download parameters you can use CustomDownloadURL. DownloadURL calls CustomDownloadUrl.
This is a 'known' issue and that Chrome on Android doesn't have the capability to show a PDF inline. On Android, you need to use CustomDownloadURL instead of DownloadURL.
To implement this workaround for Android (which also works with all other browsers) in our WebOrder sample's Customer List report (object oCustomerListSample in CustomerListSample.wo) requires just 1 line of code to be changed (in Procedure RunReport):
//Get DownloadURL of ghoWebResourceManager sFile to sUrl Get CustomDownloadURL of ghoWebResourceManager sFile True "Customer.pdf" True 0 to sUrl