Access PDFTron menu share and print function

Product: Android Native SDK

Product Version: 9.2.3

Please give a brief summary of your issue:
Access PDFTron default menu share and print functionality from custom menu

Please describe your issue and provide steps to reproduce it:
I’m using a custom menu:

val fragment = ViewerBuilder2.withUri(Uri.parse(link))
                .usingCustomToolbar(
                    intArrayOf(
                        if (isTask) R.menu.task_file_menu
                        else R.menu.file_viewer_menu
                    )
                )
                .usingConfig(config)
                .build(it)
            fragment.addHostListener(this)

When I open up my custom menu it looks like this:

I am trying to hook up my “share” and “print” button with the PDFTron Fragment’s share and print code. If I cannot, how can I grab the File that the Fragment downloaded so I can call custom code on my end to export it?

Thanks :slight_smile:

Please provide a link to a minimal sample where the issue is reproducible:

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi there,

If you implement your own custom overflow menu and you want to use our logic for share/print you can add the same id for each action we use.

Please see the id for share and print below:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
        android:id="@+id/action_share"
        android:title="share"
        app:showAsAction="never" />
    <item
        android:id="@+id/action_print"
        android:title="print"
        app:showAsAction="never" />
</menu>

You can view all our ids in the source code in the download package : PDFTron Systems Inc. | Download-center

Please let us know if this solution works for you.

Best,
Eamon

1 Like

This works. Thank you!

1 Like