I am using the following command to preview a PDF ContentVersion file inside a LWC: /sfc/servlet.shepherd/version/renditionDownload?rendition=SVGZ&versionId=0687Z000002EkVc&operationContext=CHATTER

But this just preview the 1st page of the pdf.

Does anyone know how preview a entire pdf?

Thanks in advance


1 Answer 1


I was able to preview a entire ContentVersion file using a visualforce page:


<apex:page controller="PreviewContentVersionCTR">
    <apex:iframe src="data:application/pdf;base64,{!versionData}" height="700px"/>


public class PreviewContentVersionCTR {

    private final String versionData;

    public PreviewContentVersionCTR() {
        ContentVersion cv = [SELECT Id, VersionData FROM ContentVersion LIMIT 1];       
        versionData = EncodingUtil.base64Encode(cv.VersionData);

    public String getVersionData() {
        return versionData;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .