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

Can I display attached PDF or word document embedded inside a visualforce page



I want to display uploaded PDF/word document inside a VF page. I mean user should be able toview the contents of the attached pdf/word file, when they are viewing the page.


Is it possible. Any pointers on how to achieve this?


Unfortunetly there is no out of the box visualforce way to do this. You'll need to use some other tricks. This site has some useful info on embeding PDFs, . Word docs on the other hand I am not so sure about as they don't play nice with browsers other than IE.


Thanks so much. Those links were quite helpful.


For pdf files, I tried using apex:iframe tag


when we click on view attachment, it shows pdf file in browser. So i passed that url inside apex:iframe tag and it is showing it properly inside VF page.


But same thing is not working with word files, it shows open/save dialog box when i view it.


Is there any property that we can set when we are viewing word docs so that it will open it in browser like PDF files, rather than showing open/save dialog box.





Word files don't embed in any browser but IE. there is no good way to handle word files. You'd have to upload them to a service like scribd and then use their view app to display it.