Hi All
I have an image that I am putting onto a PDF report, I have no problem in doing this. The problem I'm having is ,when I look at the PDF created, the image I have put on is poor quality. The image itself is a .png and when I view it in other packages it's a high quality image. Is there a way to ensure the image that goes onto the pdf is of the same quailty.
Thanks
Paul
Hey Guys,
I also have some additional information that will help you understand how to work with Images in your Reports.
First of all, you can forget anything related to Alpha channels. In other words, if you have a really nice image that has transparencies and shadows through the use of Alpha channels, that will not work well. This is a limitation of PDF in general. All of the PDF Ebooks that I own and have images have the same issue and therefore Infragistics is not able to do much about it. The best bet is to create "PDF Friendly" images with contain no transparencies, do not have a super sized color palette, etc.
The Document engine will convert any Alpha channel values to White. You can change the value from White to any other color so that you can try to "Fake" transparency. The only Gotcha with this is that anytime this technique is used in any application, not just the Infragistics Document Engine, is that the resulting image may have jagged edges.
Having said this, let's review the code below:
//the color that the Image Alpha will be converted to in the Report Image:
Infragistics.Documents.Graphics.Color theColor =
//New up an Infra Image (this image has an Alpha channel and some cool transparencies)
Infragistics.Documents.Graphics.Image img =
new Infragistics.Documents.Graphics.Image(Application.StartupPath + @"\trans.png");
img.Preferences.Compressor = Infragistics.Documents.Graphics.ImageCompressors.Flate;
IImage theImage = section.AddImage(img);
//Finally, use this method to set the transparent color on this particular image.
theImage.SetTransparentColor(theColor.ToHex());
The result is an image that has indeed been compressed and its alpha channel information converted from Transparent TO whatever the end user selected from the combo box. In a more real world application, you can try to use the same color as the Image Parent's background color.
Enjoy,
-Tom
Just to give an update, developer support came back and informed me that this is not a bug and Images are put onto PDF at a compression rate of 75% by design.
IMO I think this should be the other way round start at 100% then reduce if necessary, but hey !.
The solution to the problem is to use the Flate compression i.e. thisImage.Preferences.Compressor = Infragistics.Documents.Graphics.ImageCompressors.Flate this will put a lossless image onto a PDF, which I tried previously but wouldn't generate the PDF at all. Since then I have applied the latest hotfix and it works, so there may have been a bug, who knows !!
Thanks Tim
Contact developer support via the product support section on the get help page.
They will work with you to reproduce your issue and determine a solution if possible.
Hi Donald, thanks for the reply.
The original image is fine and of high quality, I have viewed in Paint Shop Pro and there is no problem with it. The only reason I tried the compression route is because I had run out of ideas as to what it could be. I could not find anything in the very simplistic documentation that is provided with Infragistics Documents.
I was expecting to be able to have an image and put it on the pdf with no loss of quality. These are technical diagrams which need to be high quality, yet I am getting colour bleed and pixalisation which is not good enough.
Could anybody from Infragistics confirm if this is a bug or if there is a solution to this problem.