How to embed a TIFF image with LAB color space?


Can you confirm whether there is a different way to embed Tiff images
into a pdf document?

Your sample project use the following code

bmp = New System.Drawing.Bitmap(input_path + "Lab8Test.tif")
img = Image.Create(doc.GetSDFDoc(), bmp)
element = f.CreateImage(img, New Matrix2D(bmp.Width, 0, 0, bmp.Height,
10, 50))

However the Tiff file I need to insert is a print quality image using
Spot colours, these are required for the printing process. The
problem we have is that the System.Drawing.Bitmap class does not
support this type of tiff image and returns an error ' Parameter is
not valid.'

I need to find a way to insert the image without using the line

bmp = New System.Drawing.Bitmap(input_path + "Lab8Test

Yes, this is one of limitations of Bitmap class in MS .NET Framework.

To go around this you could use a third party image library that
supports TIFF (you may want try using libtiff - http:// or freeimage -

Assuming that you extract LAB image data in 'lab_data' byte array, you
can pass it to PDFNet as follows:

Obj* lab_dict = pdftron.SDF.Obj.CreateDict();

// Set LAB white point
Obj* white_point = Obj.CreateArray();
lab_dict.Put("WhitePoint", white_point);

// Optional set LAB Range & BlackPoint ...

// Create LAB Color space from SDF array...
Obj lab_arr = doc.CreateIndirectArray();
ColorSpace cs = new ColorSpace(lab_arr);

// Create PDF Lab image
Image img = Image.Create(doc, lab_data,
width, height, 8, cs, Image.InputFilter.e_none);