How to get callback from DocumentActivity

Hello all

I have implement your lib version code 9.0.2
How can I get callback from DocumentActivity after save document?
I have read all document but I did’t get any solution .
My scenario is after save pdf after that send this pdf to Backend.

Thanks & Regards
Jaydeep Dhamecha


In this case I recommend using the fragment viewer (PdfViewCtrlTabHostFragment2) instead of the activity viewer so you can have access to lower level viewer methods. You can learn more about the fragment viewer here:

If you are saving local files, this is done synchronously. So you can simply get the file path after calling save and a callback is not needed, for example:

PdfViewCtrlTabHostFragment2 hostFragment = ...;
PdfViewCtrlTabFragment2 tabFragment = hostFragment.getCurrentPdfViewCtrlFragment();;
tabFragment.getFile().getAbsolutePath(); // Get path to file and save back to server.

Best Regards,

Thank you Branden

But I have implement your way after we have getting error look like this

java.lang.UnsatisfiedLinkError: No implementation found for void com.pdftron.common.RecentlyUsedCache.InitializeRecentlyUsedCache(long, long, double) (tried Java_com_pdftron_common_RecentlyUsedCache_InitializeRecentlyUsedCache and Java_com_pdftron_common_RecentlyUsedCache_InitializeRecentlyUsedCache__JJD)

Can you please help me
Thanks & Regards
Jaydeep Dhamecha

Hi, are you using the Standard version of the PDFTron Android library? If so, you will need to set “useStandardLibrary” to true in the ViewerConfig builder. ViewerConfig.Builder - PDFTron API Reference | PDFTron Systems Inc..

If not, I’d recommend trying out a sample project, i.e. pdftron-android-samples/CustomUI at master · PDFTron/pdftron-android-samples · GitHub, and compare with yours to see what’s different in the integration.


It’s working fine when we used useStandardLibrary Thank you.

But I have one more query.

I am implementing your SDK for Android, iOS and Web platform, In one of my requirement, I am suppose to have username of the particular user who have edited the pdf. Can I have username (John Miller) instead of the Guest in the attached screenshot.

Thanks in advance.

Each annotation comes with their own property for author name, in this case Annot.setTitle is what you are looking for. Be sure to surround the call with a document write lock. Could you give it a try?


Hello Team,

This is irrelevant regarding this ticket. But to be on a single thread. I am adding a question here only. Sorry for that. We are facing one issue while loading the pdf file in iOS only. We are successfully able to load the pdf file in android SDK.

Here is the file URL which we are trying to load:

We are getting following error:
Error Code=0 “Could not download file.” UserInfo={NSLocalizedDescription=Could not download file., NSLocalizedFailureReason=An unknown error has occurred.}

This is how we have loaded the pdf file:

private func showPdfTron(strUrl: String, isFromLocal: Bool) {
        documentController.delegate = self
        if isFromLocal {
            let fileURL = URL(fileURLWithPath: strUrl)
            documentController.openDocument(with: fileURL)
            documentController.toolManager.annotationAuthor = "\(UserManager.shared.current?.firstName ?? "") \(UserManager.shared.current?.lastName ?? "")"
        } else {
            guard let fileURL = URL(string: strUrl) else { return }
//            guard let testURL = URL(string: "") else { return }
            documentController.openDocument(with: fileURL)
            documentController.toolManager.annotationAuthor = "\(UserManager.shared.current?.firstName ?? "") \(UserManager.shared.current?.lastName ?? "")"
        self.isEdittingDrawing = true
        self.navigationController?.pushViewController(documentController, animated: true)

Can you please guide us, where we are going wrong? Or how to solve this error.
Thanks & Regards
Jaydeep Dhamecha

Hi @jaydeep.d,

In general for ease of communication it’s better to open a separate topic for each separate issue, this helps prevent confusion.

Regarding the issue opening the remote document on iOS: are you able to access the document from the browser on your device? I tried following the link but it seems I don’t have permission to view the document at that URL (error code 403, access denied). Is there some authorization required to access the URL?

You can set additional HTTP headers for the request using the additionalHTTPHeaders API on PTDocumentController.

Are you having trouble also opening the testURL in your snippet or is that working as expected?

Hello Team,

I have view the PDF from URL but after download the pdf show the dialog error trying to open the file.
Can you please help me guys.
Below I have add the code when I used in our Application.

val uri = Uri.parse(pdfUrl)
        val viewerConfig = ViewerConfig.Builder().useStandardLibrary(true).build()

        mPdfViewCtrlTabHostFragment =
        val ft = supportFragmentManager.beginTransaction()
        ft.replace(, mPdfViewCtrlTabHostFragment!!)

Jaydeep Dhamecha

Hi @jaydeep.d,

Apologies for the delayed response here.
I’m a little confused as I believe you said the issue was only on iOS but this code snippet looks like Android. Is this an issue on both platforms?