Without the help of PDFViewCtrl can we render a pdf document?
I am creating an app which has following requirements for a pdf file
The first page of the pdf has to be rendered
On top a search functionality needs to be provided
On bottom Thumbnail view of the pages(say 10 pages) including a seek bar needs to be shown
Yes, you are definitely able to render PDF without using PDFViewCtrl. To fulfill your goals, you can use PDFDraw and TextSearch classes.
PDFDraw takes an input a PDF page and outputs an image. With it, you can easily achieve goal (1) and goal (3) with necessary android UI programming.
TextSearch class offers functions to search within a document and you can retrieve from it the information about what has been found, where it is, etc. Now the only problem is that what if you want to highlight the found string on the output image from PDFDraw. The coordinates given by TextSearch are in PDF page space and you need to convert it to the image space. The following is the rough idea:
Suppose (x1, y1) is a point in page coordinate space and w and h represent the width and height of the page, respectively.
Also assume the page has no rotation, we can compute (s, t) as the normalized coordinate in the image space as follows:
s = x1/(w-1); //x1 is from 0 to (w-1)
t = (h-1-y1)/(h-1); //y1 is from 0 to (h-1); page y axis goes upward and image y axis goes downward
Suppose the rendered image’s width and height are W and H, then the coordinate (S, T) in the image space can be computed as:
S = sW;
T = tH;