Load an image from a file.




void SetFile(string path)

[Visual Basic]
Sub SetFile(path As String)

Throws Exceptions may throw Exception()



Name Description
path The path to the graphic file.




Load an image from file.

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

Ultimately each import goes through a ReadModule so for details of additional formats supported and the way they are imported, see the ReadModule property.

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




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.


XImage theImg = new XImage(); Doc doc = new Doc(); theImg.SetFile(Server.MapPath("../mypics/mypic.jpg")); doc.Rect.Inset(20, 20); doc.AddImageObject(theImg, false); theImg.Clear(); doc.Save(Server.MapPath("imagesetfile.pdf")); doc.Clear();