Is it possible to open a PDF or another previewable file on a certain page from the Documents and Media widget?


  • When a Documents and Media widget displays a previewable document like a PDF, it's possible to move around the different pages.
  • Is it possible to have a URL that takes you directly to the preview on a specific page of the document?


  • Liferay DXP 7.2, 7.3, 7.4
  • Quarterly Release 2023.Q3, 2023.Q4, 2024.Q1


  • Without relying on a particular Documents and Media widget, it's possible by using the friendly URL and the parameter previewFileIndex. For example:
    • /documents/20119/32528/myfile.pdf?previewFileIndex=2
    • /documents/d/mysite/myfile?previewFileIndex=2
  • Having such a URL based off the D&M widget is not possible out of the box.
  • One way to manage it would be:
    1. Customize the JPS document-library-preview-document/src/main/resources/META-INF/resources/preview/view.jsp to manage a parameter <portlet-namespace>currentPage passed in the URL.
    2. Then pass the value to the JS component DocumentPreviewer, instead of the default value 1.
  • A different approach would be:
    • Use an Asset Publisher together with a Widget Display Template that directly employs the friendly URL with the parameter previewFileIndex.
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0