Created
July 17, 2015 16:22
-
-
Save bjoerntx/b209e1461a2d82a90627 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void InsertWatermarkImages() | |
{ | |
// remove all existing watermarks | |
RemoveWatermarkImages(textControl1); | |
foreach (TXTextControl.Page page in textControl1.GetPages()) | |
{ | |
// create a new watermark image | |
Bitmap bmp = CreateDraftImage(); | |
// create a new TXTextControl.Image object and mark | |
// as watermark | |
TXTextControl.Image img = new TXTextControl.Image(bmp); | |
img.Name = "Watermark"; | |
img.Sizeable = false; | |
img.Moveable = false; | |
// calculate the location to center the image | |
Point pImageLocation = new Point( | |
(page.Bounds.Width / 2) - (PixelToTwips(bmp.Size.Width)) / 2, | |
(page.Bounds.Height / 2) - (PixelToTwips(bmp.Size.Height)) / 2); | |
// add the image to the page | |
textControl1.Images.Add( | |
img, | |
page.Number, | |
pImageLocation, | |
TXTextControl.ImageInsertionMode.BelowTheText); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment