For the complete documentation index, see llms.txt. This page is also available as Markdown.

Add an API for Cordova / Ionic

The following example hides text highlight and arrow annotation creation tool from the quick menu and annotation toolbar:

To use in ToolManagerBuilder:

ToolManagerBuilder.From().DisableToolMode(new ToolManager.ToolMode[] {
    ToolManager.ToolMode.ArrowCreate,
    ToolManager.ToolMode.TextHighlight
});
ToolManagerBuilder.from().disableToolMode(new ToolMode[]{
    ToolManager.ToolMode.ARROW_CREATE,
    ToolManager.ToolMode.TEXT_HIGHLIGHT}
)
ToolManagerBuilder.from().disableToolMode(arrayOf(
    ToolManager.ToolMode.ARROW_CREATE,
    ToolManager.ToolMode.TEXT_HIGHLIGHT
))

To use in ToolManager:

mToolManager.DisableToolMode(new ToolManager.ToolMode[] {
    ToolManager.ToolMode.ArrowCreate,
    ToolManager.ToolMode.TextHighlight
});
mToolManager.disableToolMode(new ToolMode[]{
    ToolManager.ToolMode.ARROW_CREATE,
    ToolManager.ToolMode.TEXT_HIGHLIGHT}
);
mToolManager.disableToolMode(arrayOf(
    ToolManager.ToolMode.ARROW_CREATE,
    ToolManager.ToolMode.TEXT_HIGHLIGHT
))

Disable annotation editing

To disable annotation editing for certain annotation type(s), you can set it in a centralized place with either ToolManagerBuilder or ToolManager depending on the fit.

The following example disables editing of ellipse and rectangle annotations:

To use in ToolManagerBuilder:

ToolManagerBuilder.From().DisableAnnotEditing(new Java.Lang.Integer[]
{
    new Java.Lang.Integer((int)Annot.Type.e_Circle),
    new Java.Lang.Integer((int)Annot.Type.e_Square)
});
ToolManagerBuilder.from().disableAnnotEditing(new Integer[]{
    Annot.e_Circle,
    Annot.e_Square}
);
ToolManagerBuilder.from().disableAnnotEditing(arrayOf(Annot.e_Circle, Annot.e_Square))

To use in ToolManager:

Disable functionality

Functionality that is not directly tied to annotation creation or editing such as text selection, form filling, link following etc. can also be disabled. Each functionality is in the form of a Tool. Once a Tool is disabled, ToolManager will never switch to it. Instead, it will switch to the Pan tool. Pan tool cannot be disabled.

The following example disables form filling and link following:

To use in ToolManagerBuilder:

To use in ToolManager:

3. Define the method string that matches the JS declaration

Open file src/android/com/pdftron/cordova/PDFTron.java.

Add the method key that matches the JS declaration:

4. Implement the new method

In the same file, src/android/com/pdftron/cordova/PDFTron.java, find entry point execute method:

The actual implementation will depend on the actual functionality.

5. Push the code and integrate the updated plugin

Push your changes back to your forked copy of the repo.

Next, from the command line, navigate to the root of your Cordova app project and remove the Apryse Cordova plugin as follows:

Then integrate your forked copy of the repo with the changes, using the appropriate names for your Git(Hub) name/repo:

The new method is now ready to use.

Note that if you later on need to update any code in the plugin (for example to add another method, or to fix a bug), you will need to remove and re-add the Cordova plugin every time in order to make the changes visible to your app.

6. Access the new functionality

The app can now access the new API as follows:

6. All done!

If you're only developing for Android, then you're all done!

If you're also deploying on iOS, you'll need to repeat steps 3 and 4 for iOS.

If you're developing for both iOS and Android, please consider submitting a PR, as upstreaming the change will simplify your developing and make the API available for other Apryse customers.

Last updated

Was this helpful?