pdftron-react-native icon indicating copy to clipboard operation
pdftron-react-native copied to clipboard

Custom floating text

Open damianimashaun opened this issue 2 years ago • 4 comments

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

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="{&quot;annotationNumber&quot;:&quot;3&quot;,&quot;trn-mention&quot;:&quot;{\&quot;contents\&quot;:\&quot;grins\&quot;,\&quot;ids\&quot;:[]}&quot;}"/><contents>grins</contents></text></annots></xfdf>

damianimashaun avatar Mar 22 '22 13:03 damianimashaun

@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 avatar Mar 30 '22 17:03 sgong-pdftron

@sgong-pdftron I'm okay to give this a try. Can you help with an example or some pointers ?

damianimashaun avatar Apr 06 '22 08:04 damianimashaun

@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: image

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 avatar Apr 06 '22 14:04 sgong-pdftron

@sgong-pdftron I'll give this a try and let you know how it goes, thank you.

damianimashaun avatar Apr 07 '22 14:04 damianimashaun