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
Heidi ApaHeidi Apa 

How to show PDF content in iframe in visualforce


I am trying to show a PDF content in a Visualforce for rendering this one as a PDF with more content. I am trying this but not working...


              ContentDocument contDoc;
              ContentVersion cv;
                contDoc = [SELECT Id,Title FROM ContentDocument WHERE Title ='Document];
                cv = [SELECT VersionData FROM ContentVersion WHERE ContentDocumentId = :contDoc.Id AND IsLatest =                                                true];
               String contenidoPDF = EncodingUtil.base64Encode(cv.VersionData);

Visualforce page:
<iframe src="data:application/pdf;base64,{!contenidoPDF}" height="100%" width="100%" ></iframe>

Thank you!!!
Heidi ApaHeidi Apa
Sorry, I forget a ' in the SELECT when I was copying...  contDoc = [SELECT Id,Title FROM ContentDocument WHERE Title ='Document'];
Still not working
laure carnelos 7laure carnelos 7