Adding custom information on shapes and custom items

Detailed description of issue
{Hello,

  1. I’m intrested to know if it’s possible to add custom information on shapes like lines. Basically we are drawing a line and we need to attach some custom informations.

  2. Also we have some items in database and an item has the next properties: id, name, code, description, type, image/ color, otherProperties. We want to draw on the pdf using this items. The item type can be for example, line or a stamp. If it’s line we need to draw a line shape using the properties of the item (in otherProperties for ex we have color). If it’s type stamp we need to use this item as a stamp using the item properties.}

Hey there!

Yes both of these scenerios is possible. Each annotation is just a JS class, so you can assign any properties you like to it. If you need to serialize that data into XFDF, its a bit more involved but definitely possible - let me know if you need help doing this.

For drawing annotations from data in a database, here is a couple resources to get you started.

Basically you just need to load your data from your database, create a the corresponding annotation class, and set its properties based on your database data.

I hope this helps! Let me know if you have any more questions.

Thanks,
Logan

Hey Logan, I would like to add a custom property to the xfdf of the annotation. Since it only gives one field to store the subject or author, I’d like to add another property to store the authors id so I don’t need to run any mapping after annotations are loaded like in your example.

Here’s the example XFDF I’d like to implement adding authorid="":
<text subject="Comment" page="5" rect="262.13,465.90,285.38,489.15" flags="print,nozoom,norotate" name="651eab92-9258-f676-b5c0-9767cb1ab932" title="Andy" authorid="4635272" date="D:20171226125004-08'00'" color="#FFFF00" opacity="0.5" creationdate="D:20171226125004-08'00'" icon="Comment">

Could you show me an example of how I could accomplish this?

Thanks