ImagXpress™ v8 .NET FAQ

Contact Support



Q1What is the difference between ImagXpress Document, Standard, View & Photo Editions?
Q2How can I determine if I have the latest version of a Pegasus control?
Q3What DLLs do I need to distribute with my application?
Q4How do I distribute my application?
Q5How do I load images into the ImagXpress 8 control?
Q6How do I save image data to a file with the ImagXpress 8 control?
Q7How do I create a multi-page TIFF image?
Q8How do I save image data to memory?
Q9How do I control the compression of TIFF images?
Q10How do I handle errors with the control?
Q11How do I draw on the ImagXpress control?
Q12How do I resize image data?
Q13I tried to open a PDF in ImagXpress and got a -1062 message. Why?
Q14How do I print images with the control?
Q15How do I free the resources of the control(s) when done using it?
Q16When using the ImagXpress .NET control I get the following error message. “Unable to load DLL (PegasusImaging.Common.ImagXpress8.8.0.15.0.ssm)” Why?

Q1: What is the difference between ImagXpress Document, Standard, View & Photo Editions?
Please refer to the link listed below:
Comparison of ImagXpress Editions

Q2: How can I determine if I have the latest version of a Pegasus control?
Please download the PegConnect utility program from the following link: PegConnect
or reference the Latest Builds page.

Q3: What DLLs do I need to distribute with my application?
PegasusImaging.WinForms.ImagXpress8.dll
PegasusImaging.Resources.ImagXpress8.dll
PegasusImaging.Advanced.ImagXpress8.dll

Q4: How do I distribute my application?
PLEASE NOTE: You must have received unlock codes in order to distribute applications. These are received when runtimes are purchased. If you have not received them you should Contact Sales.

A) Windows Forms Application

1) Add a declaration to the UnlockControl function in the Licensing class BEFORE InitializeComponent(). For example:

For C# Developers:
PegasusImaging.WinForms.ImagXpress8.Licensing.UnlockControl(1234,1234,1234,1234);
InitializeComponent();

For Visual Basic .NET Developers:
PegasusImaging.WinForms.ImagXpress8.Licensing.UnlockControl(1234,1234,1234,1234)
InitializeComponent()

2) Call the UnlockRuntime function in the Licensing class where the application begins. For example:

For C# Developers:
imagXpress.License.UnlockRuntime(1234,1234,1234,1234);

For Visual Basic .NET Developers:
imagXpress.License.UnlockRuntime(1234,1234,1234,1234)

3) Rebuild the application on the machine where the ImagXpress toolkit is installed and registered.

4) Make sure to distribute the DLL mentioned in #1 above.

Please Note: If you have an ImagXpress Processor object created at design-time in your application you will likely see an "ImagXpress 8 License Validation Check has Failed Message" when distributing the application receive. The reason for this message is the ImagXpress 8 control has not been licensed because an instance of the Processor object was created before the ImagXpress object. This can be resolved by removing the Processor object from the form and creating the Processor object at runtime in your code after calling the UnlockRuntime method on the ImagXpress object.

B) Add-on licensing

1) Add a declaration to the AddOnLicense function in the Licensing class. For example:

For C# Developers:
imagXpress.License.AddOnLicense(“licensestringhere”);

For Visual Basic .NET Developers:
imagXpress.License.AddOnLicense(“licensestringhere”)

C) Web licensing

1) Add a declaration to the UnlockWeb function in the Licensing class. For example:

For C# Developers:
imagXpress.License.UnlockWeb(“licensestringhere”);

For Visual Basic .NET Developers:
imagXpress.License.UnlockWeb (“licensestringhere”);


Q5: How do I load images into the ImagXpress 8 control?
There are three main ways to load an image. You can load an image via a filename/URL, from a .NET Stream object, or from a handle to an image's DIB or HBITMAP.

To load an image via a filename or URL, you create an ImageX object with the static member function FromFile to load data into that object. Please refer to the sample code below:

For C# Developers:
ImageView.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromFile("C:\\benefits.tif");

For Visual Basic .NET Developers:
ImageXView1.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromFile("C:\benefits.tif")

To load an image via a .NET stream object, you create the ImageX object by using the static member function FromStream to load data into that object. Please refer to the sample code below:

For C# Developers:
System.IO.FileStream fs = new System.IO.FileStream("C:\\benefits.tif",System.IO.FileMode.Open,System.IO.FileAccess.Read);
ImageX.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromStream(fs);

For Visual Basic .NET Developers:
Dim fs As New System.IO.FileStream("C:\benefits.tif", IO.FileMode.Open)
ImageX.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromStream(fs)

To load an image via a DIB or bitmap, you create the ImageX object with either the static member function FromHdib or FromHbitmap. Please refer to the sample code below:

For C# Developers:
1) Create the BMP:
Bitmap bm = new Bitmap("C:\\benefits.tif");

2) Load the bitmap into the ImageXView object.
ImageX.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromHbitmap(bm.GetHbitmap());
or
ImageX.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromHdib (bm.GetHbitmap());

For Visual Basic .NET Developers:
Dim bm As New Bitmap("C:\benefits.tif")
ImageXView1.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromHbitmap(bm.GetHbitmap())
or
Dim bm As New Bitmap("C:\benefits.tif")
ImageXView1.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromHdib(bm.GetHbitmap())

Q6: How do I save image data to a file with the ImagXpress 8 control?
You need to create a SaveOptions object, set the desired file format and any other options and then call the Save method. Please refer to the sample code below for an example of this:

For C# Developers:
PegasusImaging.WinForms.ImagXpress8.SaveOptions so = new PegasusImaging.WinForms.ImagXpress8.SaveOptions
so.Format = PegasusImaging.WinForms.ImagXpress8.ImageXFormat.Tiff;
ImageXView.Image.Save("C:\\NET.tif",so);

For Visual Basic .NET Developers:
Dim so As New PegasusImaging.WinForms.ImagXpress8.SaveOptions
so.Format = PegasusImaging.WinForms.ImagXpress8.ImageXFormat.Tiff
ImageXView1.Image.Save("C:\\net.tif",so)


Q7: How do I create a multi-page TIFF image?
You need to create a SaveOptions object and then set the MultiPage property. Please refer to the sample code below for an example of this:

For C# Developers:
PegasusImaging.WinForms.ImagXpress8.SaveOptions so = new PegasusImaging.WinForms.ImagXpress8.SaveOptions();
so.Format = PegasusImaging.WinForms.ImagXpress8.ImageXFormat.Tiff;
so.Tiff.MultiPage = true
ImageX.Image.Save("C:\\NET.tif",so);

For Visual Basic .NET Developers:
Dim so As New PegasusImaging.WinForms.ImagXpress8.SaveOptions
so.Format = PegasusImaging.WinForms.ImagXpress8.ImageXFormat.Tiff
so.Tiff.MultiPage = True
ImageXView2.Image.Save("C:\\net.tif",so)


Q8: How do I save image data to memory?
The SaveToStream method needs to be used to accomplish this. Please refer to the sample code below:

For C# Developers:
PegasusImaging.WinForms.ImagXpress8.SaveOptions so = new PegasusImaging.WinForms.ImagXpress8.SaveOptions();
so.Format = PegasusImaging.WinForms.ImagXpress8.ImageXFormat.Tiff;
so.Tiff.Compression = PegasusImaging.WinForms.ImagXpress8.Compression.Group4;
imageXView1.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromFile("C:\\benefits.tif");
MemoryStream ms = new MemoryStream();
imageXView1.Image.SaveStream(ms,so);
ms.Seek(0,System.IO.SeekOrigin.Begin);

//Create a second ImageXView object and load the stream into it
PegasusImaging.WinForms.ImagXpress8.ImageXView imageXView2 = new PegasusImaging.WinForms.ImagXpress8.ImageXView();
imageXView2.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromStream(ms);

For Visual Basic .NET Developers:
Dim so As New PegasusImaging.WinForms.ImagXpress8.SaveOptions
so.Format = PegasusImaging.WinForms.ImagXpress8.ImageXFormat.Tiff
so.Tiff.Compression = PegasusImaging.WinForms.ImagXpress8.Compression.Group4
Dim ms As New System.IO.MemoryStream
ImageXView.Image.SaveStream(ms, so)
ms.Seek(0, IO.SeekOrigin.Begin)

Dim imageXView2 As New PegasusImaging.WinForms.ImagXpress8.ImageXView
imageXView2.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromStream(ms)
imageXView2.Image.Save("C:\temp.bmp")


Q9: How do I control the compression of TIFF images?
The compression is controlled by setting the Compression property to the desired setting. Please refer to the help documentation for the complete enumeration. The sample code listed below demonstrates setting the compression to TIFF G4.

For C# Developers:
PegasusImaging.WinForms.ImagXpress8.SaveOptions so = new PegasusImaging.WinForms.ImagXpress8.SaveOptions();
so.Format = PegasusImaging.WinForms.ImagXpress8.ImageXFormat.Tiff;
so.Tiff.Compression = PegasusImaging.WinForms.ImagXpress8.Compression.Group4;

For Visual Basic .NET Developers:
Dim so As New PegasusImaging.WinForms.ImagXpress8.SaveOptions
so.Format = PegasusImaging.WinForms.ImagXpress8.ImageXFormat.Tiff
so.Tiff.Compression = PegasusImaging.WinForms.ImagXpress8.Compression.Group4


Q10: How do I handle errors with the control?
ImagXpress 8 uses standard .NET structured exception handling. Please refer to the code below and to the help documentation for a complete listing of the Exceptions that are available.

For C# Developers:
try
{
   imageXView.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromFile(“C:\benefits.tif”);
}
catch (PegasusImaging.WinForms.ImagXpress8.ImagXpressException eX)
{
   PegasusError(eX,lblError);
}

For Visual Basic .NET Developers:
Try
   ImageXView.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromFile("C:\benefits.tif")
Catch ex As PegasusImaging.WinForms.ImagXpress8.ImagXpressException
   PegasusError(eX,lblError);
End Try


Q11: How do I draw on the ImagXpress control?
Drawing on an image is done via the standard .NET Graphics object. Please refer to the code samples below:

For C# Developers:
[System.Runtime.InteropServices.DllImport("gdi32.dll")] static extern bool DeleteObject(IntPtr hObject);

imageXView.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromFile("C:\\pic1.bmp");
System.Drawing.Bitmap editImage = imageXView.Image.ToBitmap(true);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(editImage);
g.DrawRectangle(System.Drawing.Pens.Red,50,50,75,100);
PegasusImaging.WinForms.ImagXpress8.ImageX.FromHbitmap(editImage.GetHbitmap());

And finally, now that we are done with the temporary image that we drew on, we have to delete it.

DeleteObject(editImage);

For Visual Basic .NET Developers:
ImageXView.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromFile("C:\pic1.bmp")

Dim editimage As New System.Drawing.Bitmap(ImageXView.Image.ToBitmap(True))
Dim g As Graphics = Graphics.FromImage(editimage)
g.DrawRectangle(System.Drawing.Pens.Red, 50, 50, 75, 100)
ImageXView.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromHbitmap(editimage.GetHbitmap())

And finally, now that we are done with the temporary image that we drew on, we have to delete it.

DeleteObject(editimage)


Q12: How do I resize image data?
A Processor object needs to be created and then an Image object passed to it. Please refer to the sample code below:

For C# Developers:
imageXView.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromFile("C:\\benefits.tif");
PegasusImaging.WinForms.ImagXpress8.Processor prc = new Processor(imageXView.Image);
System.Drawing.Size temp = new System.Drawing.Size(50,50);
prc.Resize(temp, PegasusImaging.WinForms.ImagXpress8.ResizeType.Fast);

For Visual Basic .NET Developers:
ImageXView.Image = PegasusImaging.WinForms.ImagXpress8.ImageX.FromFile("C:\pic1.bmp")
Dim prc As New PegasusImaging.WinForms.ImagXpress8.Processor(ImageXView.Image)
Dim temp As New System.Drawing.Size(50, 50)
prc.Resize(temp, PegasusImaging.WinForms.ImagXpress8.ResizeType.Fast)


Q13: I tried to open a PDF in ImagXpress and got a -1062 message. Why?
ImagXpress supports a subset of PDFs. If you want full Adobe PDF Support you will need to add on the PDFXpress toolkit. ImagXpress will save b&w and color images to PDF, and will open up the PDFs it creates. Most other PDFs have non image data inside them so ImagXpress will not open these. PDFXpress is available as an add on to ImagXpress for a discount.

Q14: How do I print images with the control?
Please refer to the C# and VB.NET Printing samples that are included with the toolkit.

Q15: How do I free the resources of the control(s) when done using it?
A recommended approach is to dispose these objects when their container is disposed. To do this, call the Dispose method from the container. Since some of the components have dependencies on the ImagXpress component, you should dispose the ImagXpress objects last. For example, in all .NET windows Forms applications, you will find a generated call to Dispose, which can be modified as follows:

Please refer to the sample code below:

For C# Developers:
{
   if (disposing)
   {
      if (components != NULL)
      {
      components.Dispose ();
   }
   imageXView1.Dispose();
   processor1.Dispose();
   imagXpress.Dispose();
   }
base.Disposing (disposing);
}

For Visual Basic .NET Developers:
If disposing Then
   If Not (components Is Nothing) Then
      components.Dispose()
   End If
   ImageXView1.Dispose()
   Processor1.Dispose()
   ImagXpress1.Dispose()
End If
MyBase.Dispose(disposing)


Q16: When using the ImagXpress .NET control I get the following error message. “Unable to load DLL (PegasusImaging.Common.ImagXpress8.8.0.15.0.ssm)” Why?
The reason for this message is that the ImagXpress control has not been licensed because an instance of the ImagXpress object has not been created. This can be resolved by creating an ImagXpress object by first placing it on the form. If you are creating the ImagXpress control at runtime you need to create the ImagXpress object first in your code. Please refer to the specific examples below:

For C# Developers:
PegasusImaging.WinForms.ImagXpress8.ImagXpress ixp = new PegasusImaging.WinForms.ImagXpress8.ImagXpress();

For Visual Basic .NET Developers:
Dim ixp As New PegasusImaging.WinForms.ImagXpress8.ImagXpress()


Sitemap | © 2008 Pegasus Imaging Corporation. All Rights Reserved. | Privacy Statement.