Hi,
I'm working on display PDFs in a read only format. So not allowing the user to add annotations.
Setting readonly on the view to true: `pdfViewCtrl.setReadonly(true);` works great for the popup menu when text is selected, you only see the 'copy' action.
However if you long press on a non-text section of the PDF your still presented with a large popup menu of options such as signature, note, eraser etc, from the Pan tool.
I've fixed this by applying the same logic found in the TextSelect.java tool `onCreate()` method:
boolean isReadOnly = false;
try {
isReadOnly = (((ToolManager)mPDFView.getToolManager()).getReadOnly());
} catch (Exception e) {
}
if (!isReadOnly) {
mMenuTitles.add(new MenuEntry("highlight", getStringFromResId(R.string.tools_qm_highlight)));
mMenuTitles.add(new MenuEntry("strikeout", getStringFromResId(R.string.tools_qm_strikeout)));
mMenuTitles.add(new MenuEntry("underline", getStringFromResId(R.string.tools_qm_underline)));
mMenuTitles.add(new MenuEntry("squiggly", getStringFromResId(R.string.tools_qm_squiggly)));
}
To the Pan.java tool `onCreate()`, like so:
boolean isReadOnly = false;
try {
isReadOnly = (((ToolManager)mPDFView.getToolManager()).getReadOnly());
} catch (Exception e) {
}
if (!isReadOnly) {
mMenuTitles.add(new MenuEntry("sticky note", getStringFromResId(R.string.tools_qm_sticky_note)));
mMenuTitles.add(new MenuEntry("floating sig", getStringFromResId(R.string.tools_qm_signature)));
mMenuTitles.add(new MenuEntry("freehand", getStringFromResId(R.string.tools_qm_freehand)));
mMenuTitles.add(new MenuEntry("free text", getStringFromResId(R.string.tools_qm_free_text)));
mMenuTitles.add(new MenuEntry("arrow", getStringFromResId(R.string.tools_qm_arrow)));
mMenuTitles.add(new MenuEntry("line", getStringFromResId(R.string.tools_qm_line)));
mMenuTitles.add(new MenuEntry("rectangle", getStringFromResId(R.string.tools_qm_rectangle)));
mMenuTitles.add(new MenuEntry("oval", getStringFromResId(R.string.tools_qm_ellipse)));
mMenuTitles.add(new MenuEntry("ink eraser", getStringFromResId(R.string.tools_qm_eraser)));
}
I'm hoping this helps someone else, or is worth incorporating into the main stream (or some version of it)
Jon