0

I'm trying to use the following URL format to preview file in LWC but however it shows only the first page as image not the entire file. Is there a way to preview the entire file and not just 1 page?

Preview_URL:

  /sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=
3
  • Does this answer your question How to view the content Document in Lightning Community
    – Shamina
    Commented Mar 9, 2022 at 6:20
  • no, actually I'm using the same URL format and it displays only the first page as image Commented Mar 9, 2022 at 14:31
  • Have you implemented any solution for the same issue? Currently I'm facing same issue, I'm doing preview files using custom lwc component but pdf first page showing only.
    – Yusuf Khan
    Commented Feb 26 at 20:13

1 Answer 1

0

You have to request each page via the URL parameters: e.g.

currentpage = 0;

get URL() {
return  '/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=068XXX&page=+'currentpage;
}

To see more pages, you can give the user a previous and next button

<lightning-button class="slds-float_right" label="Next Page" onclick={nextPage}></lightning-button>
<lightning-button class="slds-float_right" label="Previous Page" onclick={previousPage}></lightning-button>
enter code here



previousPage() {
        if (this.currentpage >= 1) {
            this.currentpage --;
        }
    }

    nextPage() {
        if (this.currentpage >= 0) {
            this.currentpage ++;
        }
    }

You must log in to answer this question.

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