+ Start a Discussion
cnp_nareshcnp_naresh 

How to display PDF doc in the site

HI All,

 

    I uploaded a PDF doc in the Documents standard object. I unchecked Internal Use Only option and checked Externally Available Image . How to display this PDF doc in the external sites. 

 

Thanks,

Naresh B

Sridhar BonagiriSridhar Bonagiri

Hi,

 

Please let me know where you want to display this document , But according to your need you can display directly getting the document URL in the sites, if this is not working please upload the document in to static resource , refer the static resource and display the PDF file on site.

 

 

Sridhar Bonagiri

Ulas KutukUlas Kutuk

You must reach the document id in your controller class first 

 

 public string logoId{get;set;}
    public Document Logo;
    
    public void displayLogo()  
    {
        Logo=new Document();
        Logo=[SELECT Id FROM Document WHERE Name=:MNConfig.Public_Site_Logo__c];
        logoId=Logo.Id;
        
    }

 Then in your VF page you can reach documents using this kind of url

 

<apex:image width="650px" height="100px" value="/servlet/servlet.FileDownload?file={!logoId}"/>

 This is example for dispalying image using documents,the main thing is calling docuemnt  in VF page like

value="/servlet/servlet.FileDownload?file=YOUR_DOCUMENT_ID