A question on embedding JPEG images in PDF.

Q: we are not able to set bits per component of JPEG images to 24 when
we trying to embed images in PDF. The original image has bpc 24. We
used Image.Create(SDFDoc doc, FilterReader image_data, int width, int
height, int bpc, ColorSpace color_space) method but the output pdf is
blank.
-----
A: It seems that you are calling a method that is used to embed RAW/
decompressed image data. In case you need to embed JPEG images
directly, you can call Image.Create(doc, "my.jpg"); The method will
automatically infer all paramaters (bpc, color space, etc) from the
input stream.

Btw, bpc stands for 'bits per component' and not for 'pits per pixel'.

'pits per pixel' = 'bits per component' * num_colorants.

For grayscale image, 'num_colorants' is 1, for RGB is 3, for CMYK it
is 4.

Another way to embed JPEG image (e.g. if you are dealing with a JPEG
stored in memory) is as follows:
...
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap("my.jpg");
StdFile file = new StdFile("my.jpg", StdFile.OpenMode.e_read_mode);
FilterReader reader = new FilterReader(file);
pdftron.PDF.Image img = Image.Create(doc, reader, bmp.Width,
bmp.Height, 8, ColorSpace.CreateDeviceRGB(), Image.InputFilter);
...

For full sample code please refer to AddImage sample project (http://
www.pdftron.com/net/samplecode.html#AddImage).