I'm using the Android version of PDFNet 6.5.0.
I need to set the vertical scroll of the PDFViewCtrl to an absolute point in the pdf, expressed in PDF Canvas coordinates.
For example, say that I want to zoom to the middle of the second page.
I could get the y coordinate, in PDF Canvas position like:
int y = doc.getPage(1).getPageHeight() + (doc.getPage(2).getPageHeight() / 2)
How could I scroll to the y position?
I'm trying to do it with PDFViewCtrl#setVScrollPos()
, but I don't know how to convert y
to a valid parameter for this method.
Have you tried to use PDFViewCtrl#scrollTo(int, int)?
i.e. first convert points from PDF space to canvas space(PDFViewCtrl#convPagePtToCanvasPt), then scrollTo the position.