LEADTOOLS Support
Imaging
Imaging SDK Examples
How To: Saving Annotations to Multiple Pages in a TIFF
#1
Posted
:
Friday, August 11, 2017 3:04:49 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 163
Was thanked: 9 time(s) in 9 post(s)
Here's our documentation page on how to save annotations to a TIFF document:
https://www.leadtools.com/help/leadtools/v19m/dh/an/anncodecs-savetotag.htmlThere is also an overload to let you save it to multiple pages:
Code:
public RasterTagMetadata SaveToTag(
AnnContainer container,
int pageNumber,
bool saveToWang)
The major difference is the insertion of the second parameter that specifies what page in the TIFF to save the tag to--this means that different AnnContainers can be saved to different pages. Here's a code snippet which demonstrates how to specify the tag, then subsequently embedding those tags in the image.
Code:
private static void SaveTags(string tiff)
{
AnnContainer page1Annotations = new AnnContainer();
page1Annotations.Children.Add(new AnnRectangleObject(new LeadRectD(100, 100, 100, 100)));
AnnContainer page2Annotations = new AnnContainer();
page2Annotations.Children.Add(new AnnRectangleObject(new LeadRectD(200, 200, 100, 100)));
AnnCodecs ac = new AnnCodecs();
using (RasterCodecs codecs = new RasterCodecs())
{
RasterTagMetadata rtmd1 = ac.SaveToTag(page1Annotations, 1, false);
RasterTagMetadata rtmd2 = ac.SaveToTag(page2Annotations, 2, false);
codecs.WriteTag(tiff, 1, rtmd1);
Console.WriteLine("Wrote a tag containing {0} annotations to page 1", page1Annotations.Children.Count);
codecs.WriteTag(tiff, 2, rtmd2);
Console.WriteLine("Wrote a tag containing {0} annotations to page 2", page2Annotations.Children.Count);
}
}
This functionality is only available in the latest version of the LEADTOOLS SDK, which can be accessed on our downloads page.
https://www.leadtools.com/downloads?category=mainNick Crook
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Imaging
Imaging SDK Examples
How To: Saving Annotations to Multiple Pages in a TIFF
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.