1

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

M.A.Bell
  • 398
  • 1
  • 16

1 Answers1

2

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.

Dusan Kovacevic
  • 1,377
  • 1
  • 13
  • 19
  • thanks for the answer but it steel doesn't work, i'am using primefaces 6.1 primefaces-extention 6.1.1. – M.A.Bell Nov 20 '17 at 12:49
  • Even with PDF example I provided in the answer? – Dusan Kovacevic Nov 20 '17 at 12:54
  • your version of PF-extensions does not have some known issue related to opening named destinations. can you explain please – M.A.Bell Nov 20 '17 at 13:02
  • I wrote that in case that you didnt use PF-extensions 6.1.1. But since you are using ver 6.1.1 I am sure that you can disregard that: in my tests I used the same version and it worked fine with PDF example I provided. – Dusan Kovacevic Nov 20 '17 at 13:17