opening pdf-files at a specific page, bookmark or goal.

Hi,

I have a PDf-file which i can open when I click on a button. But, is it possible

to open a specific bookmark(Page) on this button click.

Here is the code to open a pdf file:

import java.awt.BorderLayout;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFrame;

publicclass PdfOpenextends JFrame{

private JButton button =null;

public PdfOpen(){

init();

setVisible(true);

}

privatevoid init(){

getContentPane().add(getButton(), BorderLayout.CENTER);

pack();

}

private JButton getButton(){

if(button ==null){

button =new JButton("View");

button.addActionListener(new ActionListener(){

publicvoid actionPerformed(ActionEvent evt){

ViewButtonActionPerformed(evt);

}

});

}

return button;

}

privatevoid ViewButtonActionPerformed(ActionEvent evt){

open();

}

privatevoid open(){

try{

Runtime r = Runtime.getRuntime();

Process p = r.exec("rundll32 url.dll,FileProtocolHandler C:\\Documents and Settings\\PMISXP0\\Desktop\\facsgs_33.pdf");

}

catch(Exception e){

System.out.println(e);

}

}

publicstaticvoid main(String args[]){

PdfOpen pdfOpen =new PdfOpen();

}

}

Please help.

Thanks

[3181 byte] By [seemap123a] at [2007-11-27 8:26:26]
# 1
Well this depends on the executable ....If you are using the acroreader the following paramters /A "page=10=OpenActions" "<path to pdf>"should open the document on page 10.
marco@dea at 2007-7-12 20:15:51 > top of Java-index,Desktop,Core GUI APIs...
# 2
To open at a specific page, use the page parameter.To open at page 10 :mypdf.pf#page=10See this document for a full list : http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf-- Bye. http://www.rgagnon.com/howto.html
RealHowToa at 2007-7-12 20:15:51 > top of Java-index,Desktop,Core GUI APIs...
# 3
Thanks for the respones.I tried using it asProcess p = r.exec("rundll32 url.dll,FileProtocolHandler C:\\Documents and Settings\\PMISXP0\\Desktop\\facsgs_33.pdf #page=141");Did not work. I am not sure where I'm wrong. Please help.Thanks
seemap123a at 2007-7-12 20:15:51 > top of Java-index,Desktop,Core GUI APIs...
# 4

Oups, my answer assumes that you were dispalying a PDF through http.

Like said before by someone else, for command shell the command is different.

See http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf#page=5

Acrobat.exe /A "page=10=OpenActions" "C:\example.pdf"

--

http://www.rgagnon.com/howto.html

RealHowToa at 2007-7-12 20:15:51 > top of Java-index,Desktop,Core GUI APIs...