Here we read a TIFF file and present the data to the Image
object. We then read a mask image and assign that to our Image.
Finally we add the image to our document and then save the PDF.
[C#]
Doc theDoc = new Doc();
XImage theImg = new XImage(); XImage theMsk = new XImage();
theImg.SetFile(Server.MapPath("../mypics/mypic.tif")); theMsk.SetFile(Server.MapPath("../mypics/mymask.jpg"));
theImg.SetMask(theMsk, true); theMsk.Clear();
theDoc.Color.String = "0 0
0"; theDoc.FillRect(); theDoc.Rect.Inset(20,
20); theDoc.AddImageObject(theImg,
true); theImg.Clear(); theDoc.Save(Server.MapPath("imagesetmask.pdf")); theDoc.Clear();
[Visual
Basic]
Dim theDoc As Doc = New Doc() Dim theImg
As XImage = New XImage() Dim theMsk As XImage = New XImage()
theImg.SetFile(Server.MapPath("../mypics/mypic.tif")) theMsk.SetFile(Server.MapPath("../mypics/mymask.jpg"))
theImg.SetMask(theMsk, True) theMsk.Clear()
theDoc.Color.String = "0 0
0" theDoc.FillRect() theDoc.Rect.Inset(20,
20) theDoc.AddImageObject(theImg,
True) theImg.Clear() theDoc.Save(Server.MapPath("imagesetmask.pdf")) theDoc.Clear()
Given the following input images.
mypic.tif |
mymask.jpg |
This is the kind of output you might expect.
imagesetmask.pdf
|