I am having trouble drawing images to a PDF. The images are uploaded by users of a website, so I can't just use a format that I know works.
I retrieve the images as bytes from a database and place them in Image objects. I can save these images to disk and open the files with a viewer, and everything works fine when I do this.
I then create an XImage using XImage.FromGdiPlusImage and use XGraphics.DrawImage to draw it to the PDF. When I open the PDF, sometimes I get a black image with noise where the image should have been. This happens with JPG files. I have tried to convert such a file to TIFF, and in this case the image appears fine. I have tried using Photoshop to save the JPG in a very basic and compatible way, but that didn't help.
Has anyone else experienced this and found a solution? Is there documentation which specifies which formats are acceptable to XImage? If not, any ideas for a workaround?
Thanks in advance