Q: I want to open on the page where the first highlight appears. This
is a sample of the code that I am executing.
Page pages = ...
If(pagehashighlight && openactionnotset) {
doc.setOpenAction(Action.createGoto(Destination.createFitH(pages,0)));
}
-----
A: doc.setOpenAction(Action.createGoto(Destination.createFitH(pages,
0)));
should do the work as long as pages is part of the page sequence.
Are you sure that setOpenAction is invoked (i.e. is (pagehashighlight
&& openactionnotset) == true) ?
Are you saving the file?
As a quick test you may want to try the following:
// In JAVA (C#, C/C++, VB is similar)
PDFNet.initialize();
PDFDoc doc=new PDFDoc("my.pdf"));
doc.initSecurityHandler();
if (doc.getPageCout()<4) return;
doc.setOpenAction(Action.createGoto(Destination.createFitH(doc.getPage(4),
0)));
doc.save("out.pdf"), SDFDoc.e_linearized, null);