RDLC Embedded Image Distorted In PDF

Mike G picture Mike G · Feb 4, 2011 · Viewed 10.5k times · Source

I have a very simple RDLC report I've built with a PNG image in the header. After many trials we could not get external images to work with the report in staging and production.

I then embedded the image in the RDLC and deployed the updated file. The image displays in the ReportViewer control fine. However, when using the export functionality of the viewer to get a PDF the image comes out garbled and distorted. It basically looks as if the image was like the Star Wars intro text but repeated vertically till it disappears. This happens both on my test machine and in stage/production.

Is there something I'm not doing correctly with embedding the image? I've thought about seeing if I could MIME encode the image another way and then insert that into the RDLC. Seems stretched to work though.

Answer

Mike G picture Mike G · Feb 4, 2011

Figured this out.

It does have to do with the encoding, in a way. It appears that the PNG encoding is doing weird things. I tried JPEG and GIF encodings and both work in the ReportViewer and PDF export. I tried changing to different PNGs (transparency and non-transparent) and had various distortion issues.

It is my suggestion that if using an embedded image with the ReportViewer that will be exported to PDF that you should use GIFs or JPEGs for embedding in your RDLC.