|
Here we read a TIFF file and present the data to the XImage
object. We then add the image to our document and then save the
PDF.
[C#]
XImage theImg = new XImage();
Doc theDoc = new Doc();
// read the data from a file
string thePath = Server.MapPath("../mypics/mypic.tif");
FileStream theStream = File.OpenRead(thePath);
byte[] theData = new byte[theStream.Length];
theStream.Read(theData, 0, (int)theStream.Length);
theStream.Close();
// place the data into the image
theImg.SetData(theData);
theDoc.Rect.Inset(20, 20);
theDoc.AddImageObject(theImg, false);
theImg.Clear();
theDoc.Save(Server.MapPath("imagesetdata.pdf"));
theDoc.Clear();
[Visual Basic]
Dim theImg As XImage = New XImage()
Dim theDoc As Doc = New Doc()
' read the data from a file
Dim thePath As String = Server.MapPath("../mypics/mypic.tif")
Dim theStream As FileStream = File.OpenRead(thePath)
Dim theData(theStream.Length) As Byte
theStream.Read(theData, 0, CType(theStream.Length, Integer))
theStream.Close()
' place the data into the image
theImg.SetData(theData)
theDoc.Rect.Inset(20, 20)
theDoc.AddImageObject(theImg, False)
theImg.Clear()
theDoc.Save(Server.MapPath("imagesetdata.pdf"))
theDoc.Clear()

imagesetfile.pdf
|
|
|