File attachments are not working when pdf is loaded using Buffer

Product: Android SDK

Product Version:9.0.1

Please give a brief summary of your issue: File Attachments not working

Please describe your issue and provide steps to reproduce it:
I’m loading a PDF using buffers but when tried to view attachments of the PDF it’s not showing anything.

Please provide a link to a minimal sample where the issue is reproducible:
//Sample code for setting the pdfDoc
pdfDoc = new PDFDoc(pdfbytes);
mPdfViewCtrlTabHostFragment.getCurrentPdfViewCtrlFragment().getPDFViewCtrl().setDoc(pdfDoc )

//sample code to view attachments

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:



Thanks for contacting us about this. Would it be possible if you could send us a sample project that contains this issue, so we can take a closer look on our end? It would be extremely useful for our investigation of the issue.

Best Regards,

Hi Team,

Please find the sample Project attached.
Class Name : SamplePDFViewer

Following operations I’m performing

  1. Loading PdfViewCtrlTabHostFragment2 with a blank pdf
  2. Then downloaded a pdf from web url and created a PDF doc using bytes
  3. then updated the PDFViewCtrl with latest PDFDoc

Sample Code

 fileLink = Uri.parse(blankPdfUrl); //loading blank PDF
 ThumbnailsViewFragment.FilterModes[] filterModes =new ThumbnailsViewFragment.FilterModes[2];
    filterModes[0] = ThumbnailsViewFragment.FilterModes.BOOKMARKED;
    filterModes[1] = ThumbnailsViewFragment.FilterModes.ANNOTATED;
    ViewerConfig viewerConfig = new ViewerConfig.Builder()

    mPdfViewCtrlTabHostFragment = ViewerBuilder2.withUri(fileUri)
            // Specify a custom toolbar
            .usingCustomToolbar(new int[]{})
            // Specify a custom navigation component
    new DownloadFileTask(this,attachmentsUrl).execute();

One more Issue we observed is for some nested layer options not titles are displaying as empty, please find the screen shot for same

What is “attachmentsUrl”? Also, based on your original post, we don’t have a full picture of what exactly you are doing, please kindly provide a project and video demonstration so we can proceed with more investigation.

From a brief guess, I think you are not loading the new document after documentLoaded event which could be the problem, but since I don’t have a full picture of you code, this is just a guess.

I should also mention that “handleViewFileAttachments” handles files with existing attachment baked into it, i.e. if you open the same file in Adobe, you should be able to see attachment in Adobe as well. You cannot do that with a random blank file.


Please send us this exact file. Thanks.

Hi Team,
I have uploaded the sample project here, please check. My main use case is to load a pdf using bytes with PdfViewCtrlTabHostFragment2 & PdfViewCtrlTabFragment2
CustomUI.7z (2.2 MB)

Hi, I made some changes to you file because you need to think about the timing of document ready: (3.3 KB)

I’m able to see the downloaded file:

Can you try the updated file? If you are still having issue, please provide a video explaining exactly what the problem is. Thanks.

Hi Team,

I’m attaching a video with explaining issue, let me know you need any info

Hi, in the video, I’m not seeing the changes I provided you in my previous response. Could you please look through the changes I suggested in the zip and apply them? Thanks.

I’m using the file provided by you only, i just replaced my java file with the file provided by you.
Not sure which changes you are talking about

I added a reference to the new PDFDoc that needs to be replaced, and only replace in event if document is ready, otherwise, new doc is loaded from document loaded event. In any case, please provide a zip for your latest project so we are on the same page. Thanks.

I just replaced it with your reference, please find the updated Java file. (11.3 KB)

Hi, please find updated project: (21.1 KB)

Aug-18-2021 10-24-08

Could you please give it a try?

Thanks it works with the sample, I’ll check with actual project and update you.
Also can you please suggest solution for the other issue where nested layers are not working properly also we can’t see the titles for that.
You can use the same sample project for verification, all you need to do is replace the attachmentsUrl with layerSampleUrl

Select layers options from menu

Below is the sample screenshot

Hi, I’m able to reproduce this issue, at the moment the viewer does not support nested layers. We can fix it so that the empty items don’t show up. What’s your timeline on this item? Thanks.

Hi, if you update to snapshot build 9.0.3-beta09, the invalid layers are not removed. Could you please update and give it a try? Thanks.

Sure thanks, I will update to that version and check.
To answer your previous question we need to have the nested layers support ASAP


Could you please let us know what is your release timeline?
And is the lack of this feature blocking for you?

Best regards,

Hi, tried to update lib version to 9.0.3-beta09 but seem that version is available for adding as dependency, following is the error I can see
Could not resolve com.pdftron:tools:9.0.3-beta09

Hi Team,

We are expecting nested layers to support by 31st Aug 2021