Some Viewer config options are not working

Product: Android SDK

Product Version: 9.0.1

Please give a brief summary of your issue: Viewer Config options are not working

Please describe your issue and provide steps to reproduce it: In my Viewer below options are not working
showThumbnailView(false)
showReflowOption(false)
showToolbarSwitcher(false)
showAnnotationToolbarOption(false)

Please provide a link to a minimal sample where the issue is reproducible: find sample code below
ThumbnailsViewFragment.FilterModes[] filterModes =new ThumbnailsViewFragment.FilterModes[2];
filterModes[0] = ThumbnailsViewFragment.FilterModes.BOOKMARKED;
filterModes[1] = ThumbnailsViewFragment.FilterModes.ANNOTATED;
ViewerConfig viewerConfig = new ViewerConfig.Builder()
// .showSaveCopyOption(true)
// .showPrintOption(true)
.toolbarTitle(docTitle!=null?docTitle:"")
.maximumTabCount(1)
.multiTabEnabled(false)
.documentEditingEnabled(false)
.longPressQuickMenuEnabled(false)
.thumbnailViewEditingEnabled(false)
.showEditPagesOption(false)
.showEditMenuOption(false)
.showThumbnailView(false)
.showAnnotationToolbarOption(false)
.showAnnotationsList(false)
.showToolbarSwitcher(false)
.showReflowOption(false)
.showBottomToolbar(true)
.showUserBookmarksList(false)
.userBookmarkCreationEnabled(false)
.showBookmarksView(false)
.hideThumbnailFilterModes(filterModes)
.build();

    mPdfViewCtrlTabHostFragment = ViewerBuilder2.withUri(fileUri)
            // Specify a custom toolbar
            .usingCustomToolbar(new int[]{R.menu.menu_pdf_activity})
            .usingCacheFolder(false)
            .usingCustomHeaders(headers)
            // Specify a custom navigation component
            .usingNavIcon(R.drawable.backarrow_circle_dark_blue)
            .usingTheme(R.style.PDFTheme)
            .usingConfig(viewerConfig)
            .build(this);
    mPdfViewCtrlTabHostFragment.addHostListener(this);

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,

On my end, showThumbnailView(false), showReflowOption(false), showToolbarSwitcher(false) is working for me. For example here is what I see on my end (note thumbnail, reflow, and toolbar switcher are hidden):

As for showAnnotationToolbarOption(false), this config is only applicable to the old viewer and id deprecated in PdfViewCtrlTabHostFragment2. Could you describe what you would expect this setting to do? Some screenshots would also be very helpful.

Best Regards,
Branden

Hi,
As I mentioned earlier, nothing works on my sample. I’m attaching my sample project here. Please check the sample and let me know what needs to be changed.

Class Name: SamplePDFViewer

CustomUI.7z (2.2 MB)

The issue is because you are calling “return super.onCreateOptionsMenu(menu);” in function “onToolbarCreateOptionsMenu”. If you look at your class, your base class is Activity. So here you are basically skipping over all PDFTron logic… you need to return false here which will resolve the problem:

Hi,

Thanks for the solution it worked but still I can see some annotation options like Edit and annotation list. I’m attaching 2 screenshots for reference where issue is highlighted in red


Hi, as shown in my previous reply, what I see in your sample is different than what you showed in your screenshot, please kindly supply the latest version of your project so we can take another look. Thanks.

Hi
Please find the updated class the only change I have made is making showBookmarksView as true and showOutlineList(true)

SamplePDFViewer.java (11.3 KB)

Hi, using your sample, how do I get to the state shown in your second image?

Also, what is you expected behaviour? Do you want to just hide that entire bar instead?

Hi,
I would like to hide the entire bar, the bar can be seen randomly you can see that when document is getting loaded

You can hide the AnnotationToolbar by adding the following:

        ViewerConfig.Builder builder = new ViewerConfig.Builder()
                .addToolbarBuilder(DefaultToolbars.defaultViewToolbar)

Thanks for the solution, it worked.