XImage SetStream Function. Load an image from stream. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

Load an image from stream.

 

   
Syntax  

[C#]
void SetStream(Stream stream)

[Visual Basic]
Sub SetStream(stream As Stream)

Throws Exceptions may throw Exception()

 

   

Params
 
Name Description
Stream The stream containing the graphic.

 

   

Notes
 

Load an image from stream.

The stream can contain any of the following types: JPEG, GIF, TIFF, BMP, PNG, PSD, PDB, EXIF, WMF, EMF, EPS, PS or SWF (Flash).

Different images within the file can be accessed using the Frame property. Different portions of the image can be selected using the Selection property.

 

   

Example
 

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();
string thePath;
thePath = Server.MapPath("../mypics/mypic.tif");
Stream theStream;
theStream = File.OpenRead(thePath);
theImg.SetStream(theStream);
theStream.Close();
Doc theDoc = new Doc();
theDoc.Rect.Inset(20, 20);
theDoc.AddImageObject(theImg, false);
theImg.Clear();
theDoc.Save(Server.MapPath("imagesetstream.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theImg As XImage = New XImage()
Dim thePath As String
thePath = Server.MapPath("../mypics/mypic.tif")
Dim theStream As Stream
theStream = File.OpenRead(thePath)
theImg.SetStream(theStream)
theStream.Close()
Dim theDoc As Doc = New Doc()
theDoc.Rect.Inset(20, 20)
theDoc.AddImageObject(theImg, False)
theImg.Clear()
theDoc.Save(Server.MapPath("imagesetstream.pdf"))
theDoc.Clear()


imagesetstream.pdf