0

I have built custom LWC component to preview files in Salesforce so that file preview window is open on onclick event and it only show image without other buttons(download,share, public Link) that salesforce standard preview window show.

handleImagePreview(event) {
        const fileId = event.target.dataset.id;
        const file = this.imageFiles.find(file => file.Id === fileId);
        if (file) {
            this.imageUrl = `/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=${file.Id}&operationContext=CHATTER&contentId=${file.ContentDocumentId}`;
            this.modalTitle = file.Title;
            this.showImageModal = true;
        }
    }

Now it works fine for images like jpg png and all but when I click on .docx files, it only show page=0

Here When I click preview button there are 3 request I see in Network Log in following order

1

Request URL:
https://mydomain.trailblaze.lightning.force.com/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=068bm0000031JQHAA2&operationContext=CHATTER&contentId=069bm000003cVYvAAM
Request Method:
GET
Status Code:
301 Moved Permanently

2

Request URL:
https://mydomain.trailblaze.file.force.com/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=068bm0000031JQHAA2&operationContext=CHATTER&contentId=069bm000003cVYvAAM
Request Method:
GET
Status Code:
301 Moved Permanently

3

Request URL:
https://mydomain.trailblaze.file.force.com/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=068bm0000031JQH&operationContext=CHATTER&contentId=05Tbm000003Jp6j&page=0
Request Method:
GET
Status Code:
200 OK

Is there page parameter I can pass in this? and how to handle multiple page?

this.imageUrl = `/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=${file.Id}&operationContext=CHATTER&contentId=${file.ContentDocumentId}`;
1

0

You must log in to answer this question.

Browse other questions tagged .