Hi Volker,

Try something like:

{{velocity}}
#set($url="") ## set the URL in this line between the quotation marks
#set($page="") ## set the page number here between the quotation marks
{{html}}<iframe name="PDF" src="$url#page=${page}" width="95%" height="800" 
/></body>{{/html}}

{{/velocity}} 


In a somewhat more complex scenario a similar solution works for me. I use the 
iframe HTML tag to display the PDF reader for the Mozilla browser. A separate 
page (Main.Params) has a variable I set with the value of the tag clicked from 
the tag cloud. The result is that the iframe line induces Adobe Reader to 
search for my cloud tag term in the PDF directly. This looks like the following:

==================================== START CODE 
============================================
{{velocity}}
  $xwiki.jsfx.use("js/xwiki/tooltip.js")
{{/velocity}}

{{html}}

<head>
<title>$doc.name</title>
</head>
<body title="$doc.name">

{{/html}}

{{velocity}}
  #set($docParams=$xwiki.getDocument("Main", "Params"))   ## get the XWIKI 
document I use to save the variable searchTag (Main.Params)
  #set($tag = $!{docParams.get("searchTag")})   ##Extract the value of the 
searchTag parameter
  $!{docParams.set("searchTag", "")}   ##set the search tag back to "", since 
we now have retrieved its value into $tag
  #set($l=$doc.getAttachmentList())
  #if ($l.size() > 0)
     #set($attach=${l.get(0)})   ## I use the first attachment in the document 
to be displayed
     #set($fname=${attach.getAttachment().getFilename()})
     #set ($url=$doc.getAttachmentURL($fname))
     #if(${tag.length()}>0)
        {{html}}<iframe name="PDF" src="$url#search=${tag}" width="95%" 
height="800" /></body>{{/html}} ##the search term has been set, search in the 
PDF for the term
     #else
        {{html}}<iframe name="PDF" src="$url" width="95%" height="800" 
/></body>{{/html}} ##the search term has not been set, just display the PDF
     #end
   #end
{{/velocity}}
========================================== END OF CODE 
========================================
Please remember that you need to make sure that the Adobe Reader is relatively 
new for this to work.


In the (now older) XWiki Enterprise 2.1.1.25889, which I am using, the TagCloud 
page needs to be changed too:
========================================== PART OF MAIN.TAGS 
=======================================

#if($do == 'viewTag')
  ##
  ## View tag
  ##
  #displayTagAppTitle($tag true)
  #if("$!{request.get('renamedTag')}" != '')
    #info($msg.get('xe.tag.rename.success', [$request.get('renamedTag')]))
  #end
  #set ($list = $xwiki.tag.getDocumentsWithTag($tag))
  <div>
    <div id="dashboardleft">
      <div id="dashboardleftcontent">
        <h3 class="xapp"><span>$msg.get('xe.tag.alldocs', [$tag])</span></h3>
########## Here is the change. I cut out parts that might confuse you so if it 
doesn't work, you may need to tinker a bit...:-)
        #set($docParams=$xwiki.getDocument("Main", "Params"))
        $!{docParams.set("searchTag", $tag)}  ## Set the variable here, but 
don't forget to return it to "" after retrieving it.
##########
========================================== END OF CODE 
========================================

Maybe all this helps.

Kind regards, 

Steven Calkins

-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] Im Auftrag von 
Legeinfo
Gesendet: Dienstag, 12. April 2011 23:10
An: [email protected]
Betreff: [xwiki-users] Howto? attachment pdf link with page 
anchorxxxx.pdf#page=255

The link to a specific page in a pdf document is not working:

[[Test to page 255 pdf>>attach:[email protected]#page=255]]

Is there a Workaround?

Volker

--
View this message in context: 
http://xwiki.475771.n2.nabble.com/Howto-attachment-pdf-link-with-page-anchor-xxxx-pdf-page-255-tp6266795p6266795.html
Sent from the XWiki- Users mailing list archive at Nabble.com.
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to