Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, November 4, 2008 11:49:28 AM(UTC)

grhind  
grhind

Groups: Registered
Posts: 19


I want be able to get a list of annotations stored in a tiff... specifically i want what kind of annotation it is... i don't want to have to open the document into a rasterimage and then apply the tag then loop through annotations... i want to be able to just read the tag... i've got some code below in hopes you can understand what i want. I'm using .NET v16

RasterCodecs.Startup()
Dim _Codecs As New RasterCodecs
Dim info As CodecsImageInfo
If strPath.IndexOf("http") > -1 Then
info = _Codecs.GetInformation(New System.Uri(strPath), True)
Else
info = _Codecs.GetInformation(strPath, True)
End If

Dim tag As RasterTagMetadata
For i As Integer = 1 To info.TotalPages
tag = _Codecs.ReadTag(strPath, i, RasterTagMetadata.AnnotationTiff)
'now loop through all annotations and determine what type they are...
Next
RasterCodecs.Shutdown()
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, November 4, 2008 12:15:18 PM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


You don't have to display the annotations in the viewer, but you will need to load them into an AnnContainer in order to get information about the objects.  Building on your pseudocode...:

AnnContainer tempContainer = new AnnContainer
AnnCodecs _AnnCodecs = new AnnCodecs
For i As Integer = 1 To info.TotalPages
' instead of using RasterCodecs.ReadTag, you'll need to use the
InPlaceBitmapMetadataWriter.  For an example
' check out the help file article for AnnCodecs.SaveToTag
_AnnCodecs.LoadFromTag(tagData, tempContainer
'now loop through all annotations in tempContainer and determine what type they are...
'end loop

' remove objects from tempContainer and proceed to next page
tempContainer.Objects.Clear()
Next

 
#3 Posted : Wednesday, November 5, 2008 3:39:20 AM(UTC)

grhind  
grhind

Groups: Registered
Posts: 19


i looked through the SaveToTag example you mentioned and it looks like it requires loading the file into a file stream... I didn't want to actually do that... where the ReadTag method did do what i wanted.

For i As Integer = 1 To info.TotalPages
tag = _Codecs.ReadTag(strPath, i, RasterTagMetadata.AnnotationTiff)
_AnnCodecs.LoadFromTag(tag, tempContainer)
'now loop through all annotations in tempContainer and determine what type they are...
For Each a As Annotations.AnnObject In tempContainer.Objects
If a.GetType Is GetType(AnnRedactionObject) Then
chkShowRedaction.Enabled = True
Else
chkShowAnnotations.Enabled = True
End If
Next

' remove objects from tempContainer and proceed to next page
tempContainer.Objects.Clear()
Next
 
#4 Posted : Wednesday, November 5, 2008 4:26:39 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


I figured you wouldn't need the SaveToTag since you only mentioned wanting to read the annotations, but the documentation team decided to lump those two functions together into a single example.  This is a pretty common practice for our Documentation.

Is this working as expected now?  Let me know if you need anything else.
 
#5 Posted : Wednesday, November 5, 2008 4:33:22 AM(UTC)

grhind  
grhind

Groups: Registered
Posts: 19


i got everything i need thanks
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.120 seconds.