Load an image from a file.

 

   

Syntax
 

[C#]
virtual void SetFile(string path)

[Visual Basic]
Sub SetFile(ByVal path As String)

Throws Exceptions may throw Exception()

 

   

Params
 
Name Description
path The path to the graphic file.

 

   

Notes
 

Load an image from a file.

The file can be any of the following types: JPEG, GIF, TIFF, BMP, PNG, 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 open a TIFF file using the XImage object. After we've opened the file we add the image to our document and then save the PDF.

[C#]
XImage theImg = new XImage();
Doc theDoc = new Doc();
theImg.SetFile(Server.MapPath("../mypics/mypic.tif"));
theDoc.Rect.Inset(20, 20);
theDoc.AddImageObject(theImg, false);
theImg.Clear();
theDoc.Save(Server.MapPath("imagesetfile.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theImg As XImage = New XImage()
Dim theDoc As Doc = New Doc()
theImg.SetFile(Server.MapPath("../mypics/mypic.tif"))
theDoc.Rect.Inset(20, 20)
theDoc.AddImageObject(theImg, False)
theImg.Clear()
theDoc.Save(Server.MapPath("imagesetfile.pdf"))
theDoc.Clear()


imagesetfile.pdf