Script(s)

what I learn is what u c

Simple Annotation Using Atalasoft DotImage 4.0 (Asp.net)

leave a comment »

DotNet framework 1.1 (not tested the same in 2.0) 

Make sure you have the following references in BIN

Atalasoft.dotImage.dll
Atalasoft.dotImage.Lib.dll
Atalasoft.dotImage.Webcontrols.dll
Atalasoft.shared.dll

Use the following NameSpaces

Imports Atalasoft.Imaging
Imports
Atalasoft.Imaging.WebControls
Imports
Atalasoft.Imaging.ImageProcessing
Imports
Atalasoft.Imaging.Codec
Imports Atalasoft.Imaging.Codec.Tiff

Avoid using Workspace object for simple tasks. As workspace occupies more memory (according to Atalasoft unofficial sources) and most of the operations can be done using AtalaImage object.

Annotate ONE PAGE TIFF Document

Dim tiffImage As AtalaImage
Dim watermarkimage As AtalaImage = New AtalaImage(Server.MapPath(“.”) & “watermark.jpg”)Dim overlay As OverlayCommand
Dim newAnnoatedFileName as String

tiffImage = New AtalaImage(Server.MapPath(“.”) & “Sample.tif”, 0, Nothing)
newAnnoatedFileName  = Server.MapPath(“.”)  & “\Sample-Annoated.tif”

‘Image Overlay
overlay = New OverlayCommand(watermarkimage, New Point(350, 550), 0)

overlay.Apply(tiffImage)

‘False in TiffEncoder means dont append (as the file is created for the first time there is nothing to append to.)

tiffImage.Save(newAnnoatedFileName, New TiffEncoder(TiffCompression.Default, False), Nothing)

————————————————————————————Annotate MULTIPAGE TIFF Document

Dim tiffImage As AtalaImage
Dim watermarkimage As AtalaImage = New AtalaImage(Server.MapPath(“.”) & “watermark.jpg”)Dim overlay As OverlayCommand
Dim newAnnoatedFileName as String
Dim numberofpages as integer,iCount as integer
numberofpages = RegisteredDecoders.GetImageInfo(Server.MapPath(“.”) & “Sample.tif”).FrameCountnewAnnoatedFileName  = Server.MapPath(“.”)  & “\Sample-Annotated.tif”‘350,550 does the annotation from Bottom Left to Top Right.

‘0 is the set the transparency in the top Image. (Dot Image 4.0)
‘Use 1 if you are using Dot Image 3.0

overlay =
New OverlayCommand(watermarkimage, New Point(350, 550), 0)

For
iCount = 0 To numberOfPages – 1

‘Opens one frame (page) at a time as specified in iCount

tiffImage = New AtalaImage(Server.MapPath(“.”) & “Sample.tif”,  iCount, Nothing)‘Image Overlay
overlay.Apply(tiffImage)
‘Save the first page with FALSE param (as there is nothing to append to) for other pages set it to TRUE so that the same TIFF gets appended with multi frames (pages)
If iCount = 0 Then

tiffImage.Save(newAnnoatedFileName,
New TiffEncoder(TiffCompression.Default, False), Nothing)
Else
tiffImage.Save(newAnnoatedFileName, New TiffEncoder(TiffCompression.Default, True), Nothing)End If
NextIf Not watermarkimage Is Nothing Then
    watermarkimage.Dispose()
End If
If Not tiffImage Is Nothing Then
   tiffImage.Dispose()
End If

If Not overlay Is Nothing Then
   
overlay = Nothing
End If

Advertisements

Written by gchandra

August 23, 2006 at 11:18 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: