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
Nikhil ArpallyNikhil Arpally 

How to display attached pdf on visualforce page?

I am not able to display the attachment body on VF page while rendering VF page as PDF. Is there any solution for this? Thanks in advance.

NagendraNagendra (Salesforce Developers) 
HI Nikhil,

It's not possible to render a PDF that contains another PDF inside of it. The Salesforce PDF render engine can't render a Blob image. Any images need to be standard formats such as JPG, PNG, GIF, or TIFF images. There might be a few others that are supported as well, but definitely not blobs.

An existing PDF will essentially contain a wrapper around a JPG along with additional information about how to display and print it.

Hope this helps.

Kindly mark this as solved if the information was helpful.

Nikhil ArpallyNikhil Arpally

Hi Nagendra,

Thanks for replay. I have converted attachment body to EncodingUtil.Base64Encode, and tried to display the same in VF page. But I am not able to do so while rendering the page as PDF. It is working fine with normal VF page.