Adding custom widgets and GUI layout on top of PDFViewCtrl in my Android app

If I was using PDFViewCtrl class to display PDF in my Android app, is there any way I can modify the UI? Like adding buttons or textviews above and below the page image while retaining the ability to fling pages and zoom? I wasn’t quite sure how to go about that or whether I’d have to just make a layout from scratch.

A: PDFViewCtrl is derived from android.view.ViewGroup. Therefore you can easily add a View on top of the page content by doing something like:

Button bt = new Button( PDFViewCtrl.getContext());

bt.layout(100, 100, 200, 200);


You can also add a background image to PDFViewCtrl and this is illustrated in Samples\PDFViewCtrlDemo\src\com\pdftron\pdfnet\demo\pdfviewctrl\

The sample code looks as follows:


  • if you want to set the background of PDFViewCtrl to a Drawable, you

  • can first set its background to be transparent and then set the

  • drawable.


//mPDFView.setClientBackgroundColor(255, 255, 255, true);

//Drawable draw = …