Home : TIFF : Numbering a multipage TIFF
Q10137 - HOWTO: Numbering a multipage TIFF

The following example code is a simple way to add page numbers to a multipage TIFF.
Note:  This code assumes ws is a Workspace or WorkspaceViewer.

[C#]

// Prepare the drawing objects.
SolidFill fill = new SolidFill(Color.Black);
Font font =
new Font("Verdana", 12);
int num = 1;

// Loop through the pages, adding a number to the top right corner.
foreach (AtalaImage image in ws.Images)
{
    Canvas canvas =
new Canvas(image);
   
string strNum = num.ToString();

    // Calculate the position for the page number.
   
SizeF numSize = Canvas.CalculateTextSize(strNum, font);
    Point position =
new Point(Convert.ToInt32(image.Width - numSize.Width - 20), 20);

    // Draw it.
   
canvas.DrawText(strNum, position, font, fill);
    num++;
}

 

[Visual Basic]

' Prepare the drawing objects.
Dim fill As SolidFill =  New SolidFill(Color.Black)
Dim font As Font =  New Font("Verdana",12)
Dim num As Integer =  1
 
' Loop through the pages, adding a number to the top right corner.
Dim image As AtalaImage
For Each image In ws.Images
    Dim canvas As Canvas =  New Canvas(image)
    Dim strNum As String =  num.ToString() 
 
    ' Calculate the position for the page number.
    Dim numSize As SizeF =  Canvas.CalculateTextSize(strNum,font)
    Dim position As Point =  New Point(Convert.ToInt32(image.Width - numSize.Width - 20),20) 
 
    ' Draw it.
    canvas.DrawText(strNum, position, font, fill)
    num = num + 1
Next

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.

Powered By InstantKB.NET v1.3
Copyright © 2002, 2017. InstantASP Ltd. All Rights Reserved