You need to sign in to do that
Don't have an account?
Sourav Hazra
Documents are getting downloaded instead of displaying
Hi,
We have a requirement of displaying document fetched through a web service. Please refer below the controller and page section to fetch the document and display in a new page
We are able to fetch the document but facing issue while displaying the document in a new page. The document is getting downloaded whenever redirects to new page on a onclick function instead of opening the document in browser. Can you please suggest?
Controller section
=================
public class ViewPdf {
public String pdf{get;set;}
public String mimetype{get;set;}
public void fetchDoc(){
XXXNoDm_v1.XXXDocumentServicePort test = new XXXNoDm_v1.XXXDocumentServicePort();
pdf = test.getDocument('XXXXX','2000000','XXXXXX');
}
}
Page Section
===================
<apex:page controller="ViewPdf" sidebar="false" showHeader="false" action="{!fetchDoc}">
<!-- {!pdf} -->
<iframe src="data:'application/pdf';base64,{!pdf}" height="110%" width="100%"></iframe>
</apex:page>
We have a requirement of displaying document fetched through a web service. Please refer below the controller and page section to fetch the document and display in a new page
We are able to fetch the document but facing issue while displaying the document in a new page. The document is getting downloaded whenever redirects to new page on a onclick function instead of opening the document in browser. Can you please suggest?
Controller section
=================
public class ViewPdf {
public String pdf{get;set;}
public String mimetype{get;set;}
public void fetchDoc(){
XXXNoDm_v1.XXXDocumentServicePort test = new XXXNoDm_v1.XXXDocumentServicePort();
pdf = test.getDocument('XXXXX','2000000','XXXXXX');
}
}
Page Section
===================
<apex:page controller="ViewPdf" sidebar="false" showHeader="false" action="{!fetchDoc}">
<!-- {!pdf} -->
<iframe src="data:'application/pdf';base64,{!pdf}" height="110%" width="100%"></iframe>
</apex:page>
There is no in built function for this.
Please refer this link. http://pdfobject.com/markup/index.php.
Let us know if it helps.