pe:documentviewer nameddest attribute doesn't work

924 views Asked by At

I'am trying to show a pdf in a p:dialog , but i want to open pdf in a spécific destination, there is my code:

<p:commandLink     value="test" oncomplete="PF('dlg').show()"/>  

 <p:dialog header="Dialog"  widgetVar="dlg" 
  resizable="false"   
  fitViewport="true">                
                <pe:documentViewer height="500" width="800" 
                 nameddest="nature"  
                 name="helpImmo.pdf"/>                
 </p:dialog>

So the pdf is opened but in the first page

NB:when i use the page attribute it works

1

There are 1 answers

4
Dusan Kovacevic On BEST ANSWER

Attribute nameddest of pe:documentViewer can be used to open PDF in specific named destination which is technically different then bookmark.

To test if your code and project libraries work correctly, download this pdf example, include it into your project and in pe:documentViewer and set, for example, nameddest="Chapter3".

I've tested it with PF 6.1 and PF-extensions 6.1. It works OK on my side and opens requested named destination.

So make sure that

  • your PDF actually has named destination 'nature' created,
  • your version of PF-extensions does not have some known issue related to opening named destinations.

Also you can programmatically add named destinations to your PDF with iText java library as described in this example.