pdftron-react-native
pdftron-react-native copied to clipboard
Custom floating text
Hi, on web, we number annotations like on the right in screenshot, I think this is custom and not out of the box. I do not see how to achieve this behaviour in mobile, Any help please ?
![image](https://user-images.githubusercontent.com/49630919/159489249-077d0a75-3706-4f1d-847e-b9868604dd63.png)
Xfdf
<?xml version="1.0" encoding="UTF-8" ?><xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"><fields /><annots><text page="0" rect="313.230,579.830,344.230,610.830" color="#FFCD45" flags="print,nozoom,norotate" name="26342a7e-0abc-39c6-30e8-84e9ad4d35d3" title="Dami Animashaun" subject="Note" date="D:20220322135620+01'00'" StrokeThickness="1" creationdate="D:20220322135614+01'00'" icon="Comment" statemodel="Review"><trn-custom-data bytes="{"annotationNumber":"3","trn-mention":"{\"contents\":\"grins\",\"ids\":[]}"}"/><contents>grins</contents></text></annots></xfdf>
@damianimashaun this seems quite custom to your application and is not supported out-of-box. To achieve this, you'll likely need to edit Java/Obj-C code. Is that something you are OK with? Thanks.
@sgong-pdftron I'm okay to give this a try. Can you help with an example or some pointers ?
@damianimashaun for android, please find demo sample below:
You will need to look at ElementBuilder API. Complete ElementBuilder sample can be found here: https://www.pdftron.com/documentation/samples/android/java/ElementBuilderTest/?platforms=android
In particular, you need to learn how to write text, write path, write shape etc.
The starter sample to get you started with the number: https://github.com/PDFTron/pdftron-android-samples/compare/demo-sticky-note-with-number?expand=1
Demo:
As you can see, it can draw a number, next step would be you will need to look at ElementBuilder API and change the style to what you need exactly.
Once you get it working on Android, it will be almost the same step on iOS but in Obj-C as PDFTron ElementBuilder API is the same across platforms.
Could you give this a try?
@sgong-pdftron I'll give this a try and let you know how it goes, thank you.