Please give a brief summary of your issue:
Reference to previous created fragment or settings not clearing
Please describe your issue and provide steps to reproduce it:
When opening a PdfViewCtrlTabHostFragment2 by placing in a FrameLayout and then hitting the back button to go back, it seems to be holding references to some settings and when going back into the document some annotations aren’t rendering correctly afterwards
Please provide a link to a minimal sample where the issue is reproducible:
We’re not sure if we’re understanding your issue. Could you elaborate on what you mean by holding references? Could you please provide a video and runnable sample project demonstrating the issue you are having?
When we open the document we then add the annotations from xfdf string. When we navigate away from the document going back to a files list and then go back into our fragment to view the file with annotations again, sometimes our annotations are not being displayed correctly even though we are merging the annotations to the document the same time.
I’m curious if there’s a reference being held in PDFTron somewhere to the originally opened document so there’s an error with the same annotation id?
Unfortunately the description you gave is not enough for us to determine what issue you are having. Could you please provide a video and runnable sample project so we can better assist you?
In this case since you are merging XFDF individually, could you try calling: pdfViewCtrl?.update(true) after merging? Note the boolean true in the parameters.
Could you give this a try and let us know if this resolves the issue?
After reviewing the code in your sample project it looks like you are using fdfMerge, then you are not making use of our annotation manager, is there any reason why you need to enable the annotation manager?
If you remove this line that should resolve the error: toolManager.enableAnnotManager(if (hasAnnotationPermission) userID else "-1")
We do this @emallon because we do not allow users to edit annotations they did not create. For example there can be a team of people all looking at a document but they can only edit/delete annotations they create and not of others on the team.
This line up code was the only way we could figure out how to disable the delete and edit option when another user tapped on an annotation that wasn’t theirs.
Based what you have said, what you are doing is fine, however you need to call setSavingEnabled(fasle) in onTabHostShown() and onTabChanged(p0: String?)
Please see sample code below:
override fun onTabHostShown() {
mPdfViewCtrlTabHostFragment?.currentPdfViewCtrlFragment?.setSavingEnabled(false)
}
override fun onTabChanged(p0: String?) {
mPdfViewCtrlTabHostFragment?.currentPdfViewCtrlFragment?.setSavingEnabled(false)
handleTabChanged(p0)
}