File Preview in Vf Pages like Chatter File Preview

Dec 17, 2014

File prevew uses latest flash player, if you're browser have latest it shows with no errors if not it will prompts to install.

So here is Visualforce code

  <embed src="/_swf/190003/sfc/flex/DocViewer.swf"
  width="100%" height="100%" align="middle" id="renditionLarge" 
  quality="high" bgcolor="#f3f3f3" name="renditionLarge" 
  allowscriptaccess="sameDomain" allowfullscreen="true" 
  type="application/x-shockwave-flash" />

In above code only one change is need in place of <<file_record_id>> replace it with file Id , you can harcode it or can be rendered dynamically

if you observe {!$Site.Prefix}, it responsible for adding site prefix into code block if you're in site {!$Site.Prefix} returns null.

NOTE: we can Safely use it whether we're in Sites or not

Phanindra Mangipudi

Salesforce, Lightning Web Componets, Node.Js, Angular 2+, Bootstrap