function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
badibadi 

.Tiff file force download

Hi, 
I would like to force download a .tiff file on clicking a link.
Customer clicks on a link to make a call to external web service which returns .tiff file. I want to force the file to download in Visualforce page.
We do not want to save the file in Salesforce.

Thanks in advance
 
Best Answer chosen by badi
badibadi
Finally found a solution!!! 

So my call to external webservice returns blob.  Controller Code:
 
String fileString;

HTTPResponse res = http.send(req);
Blob jsonresponse=res.getBodyAsBlob();
if(myTest != null && myTest.size() > 0){
     fileString=EncodingUtil.Base64Encode(myTest);
}

Visualforce
<apex:page controller="myController" showHeader="false" sidebar="false">
		
		<iframe src="data:image/tiff;base64,{!fileString}" style="width:100%;" id="frame" frameborder="0"></iframe>
</apex:page>
Hope it helps someone
 

All Answers

badibadi
Finally found a solution!!! 

So my call to external webservice returns blob.  Controller Code:
 
String fileString;

HTTPResponse res = http.send(req);
Blob jsonresponse=res.getBodyAsBlob();
if(myTest != null && myTest.size() > 0){
     fileString=EncodingUtil.Base64Encode(myTest);
}

Visualforce
<apex:page controller="myController" showHeader="false" sidebar="false">
		
		<iframe src="data:image/tiff;base64,{!fileString}" style="width:100%;" id="frame" frameborder="0"></iframe>
</apex:page>
Hope it helps someone
 
This was selected as the best answer
Yoni LegacyYoni Legacy
Hi
Yoni LegacyYoni Legacy
I need help again, if you don't mind my question is in this link

http://developer.salesforce.com/forums/ForumsMain?id=906F0000000kDxwIAE

Thanks Badi