How do I tell the viewer to show the given page when opening my PDF?

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) {

A: doc.setOpenAction(Action.createGoto(Destination.createFitH(pages,

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)

PDFDoc doc=new PDFDoc("my.pdf"));
if (doc.getPageCout()<4) return;
0)));"out.pdf"), SDFDoc.e_linearized, null);