Some test text!

menu
search
Quick menukeyboard_arrow_down

Quick menu

QuickMenu is a convenient annotation popup menu that appears when a user long-presses on a blank space or on text contained in a PDFViewCtrl. It extends RelativeLayout and is a child view of PDFViewCtrl.

ActionMenu
Long-press on blank spacequick menu when long-press on blank space
Long-press on textquick menu when long-press on blank space
To learn more about each icon, see the icon cheat sheet.
To learn how to customize the quick menu, see the customize quick menu guide.

linkQuick menu events

A number of events may be raised when a user interacts with the quick menu. For example, events will be raised when the quick menu is shown, dismissed, or when a quick menu item is clicked. You can register a QuickMenuListener to listen to such events and implement custom behavior accordingly.

If your activity is using PdfViewCtrlTabHostFragment for viewing PDF files, you can set your listener by calling:

mPdfViewCtrlTabHostFragment.getCurrentPDFViewCtrlFragment()
    .addQuickMenuListener(new ToolManager.QuickMenuListener() {
        @Override
        public boolean onQuickMenuClicked(QuickMenuItem menuItem) {
            int which = menuItem.getItemId();
            // Handle click event...
            // Return true to stop executing internal logic
            return true;
        }

        @Override
        public void onQuickMenuShown() {
            // Called when the quick menu is shown
        }

        @Override
        public void onQuickMenuDismissed() {
            // Called when the quick menu is dismissed
        }
    });

Or you can register the listener using the ToolManager by calling ToolManager.setQuickMenuListener:

mToolManager.setQuickMenuListener(new ToolManager.QuickMenuListener() {
    @Override
    public boolean onQuickMenuClicked(QuickMenuItem menuItem) {
        int which = menuItem.getItemId();
        // Handle click event...
        // Return true to stop executing internal logic
        return true;
    }
    
    @Override
    public void onQuickMenuShown() {
          // Called when the quick menu is shown
    }
    
    @Override
    public void onQuickMenuDismissed() {
          // Called when the quick menu is dismissed
    }
});

linkHide quick menu items

If there are tools that you would like to remove from the quick menu, you can hide them by calling ToolManager.disableToolMode:

// Disable TextSquigglyCreate tool, TextStrikeoutCreate tool
mToolManager.disableToolMode(new ToolMode[]{
    ToolManager.ToolMode.TEXT_SQUIGGLY,
    ToolManager.ToolMode.TEXT_STRIKEOUT}
);

Then, when you long-press on text you will see:

quick menu image

linkToolMode icon mapping table

IconToolMode
Rectangle imageRECT_CREATE
Ellipse imageOVAL_CREATE
Polyline imagePOLYLINE_CREATE
Polygon imagePOLYGON_CREATE
Cloud imageCLOUD_CREATE
Line imageLINE_CREATE
Arrow imageARROW_CREATE
Ruler imageRULER_CREATE
Free text imageTEXT_CREATE
Callout imageCALLOUT_CREATE
Note imageTEXT_ANNOT_CREATE
Ink imageINK_CREATE
Eraser imageINK_ERASER
Signature imageSIGNATURE
Stamp imageSTAMPER
Rubber stamp imageRUBBER_STAMPER
Free highlighter imageFREE_HIGHLIGHTER
Highlight imageTEXT_HIGHLIGHT
Underline imageTEXT_UNDERLINE
Squiggly imageTEXT_SQUIGGLY
Strikeout imageTEXT_STRIKEOUT
Sound imageSOUND_CREATE
File attachment imageFILE_ATTACHMENT_CREATE
Text field imageFORM_TEXT_FIELD_CREATE
Checkbox field imageFORM_CHECKBOX_CREATE
Group select imageANNOT_EDIT_RECT_GROUP

linkDisable quick menu

If you would like to hide the long press quick menu entirely, you can do so by calling ToolManager.setDisableQuickMenu. For example:

mToolManager.setDisableQuickMenu(true);

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

PDFTron Receives USD$71 Million Growth Investment Led By Silversmith Capital Partners

Learn more
close