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.
using var doc = new Doc();
using var img = new XImage();
using var msk = new XImage();
img.SetFile(Server.MapPath("../mypics/mypic.jpg"));
msk.SetFile(Server.MapPath("../mypics/mymask.jpg"));
img.SetMask(msk, true);
doc.Color.String = "0 0 0";
doc.FillRect();
doc.Rect.Inset(20, 20);
doc.AddImageObject(img, true);
doc.Save(Server.MapPath("imagesetmask.pdf"));
Using doc As New Doc()
Dim theImg As New XImage()
Dim theMsk As New XImage()
theImg.SetFile(Server.MapPath("../mypics/mypic.jpg"))
theMsk.SetFile(Server.MapPath("../mypics/mymask.jpg"))
theImg.SetMask(theMsk, True)
theMsk.Clear()
doc.Color.String = "0 0 0"
doc.FillRect()
doc.Rect.Inset(20, 20)
doc.AddImageObject(theImg, True)
theImg.Clear()
doc.Save(Server.MapPath("imagesetmask.pdf"))
End Using
Given the following input images.
This is the kind of output you might expect.