I have multiple SSRS 2008 report templates that contain embedded images and these are currently visible as expected in any report manager previews (using rendering extension HTML 4.0). However, I need these reports to be sent out as HTML e-mails.
I believe the basic/easiest technique here is to attach the images as inline base64 string to the image tags in the HTML. Is there a way to do this automatically in SSRS or alternatively what is the best practice to achieve this or similar result (i.e. images as attachments resulting in not-too-interoperable MHTML instead of pure HTML)?
The e-mail must be displayed as-is without connecting to any external storage (i.e. it's not feasible to host the images by the sender). Additionally we won't be using the SSRS itself to send the resulting HTML/e-mails so any restrictions of such nature are not of concern.
Example of the inline base64 I was thinking:
<img src="data:image/png;base64,xxxxxxxx==" alt="Some Image">
It appears that the easiest way to achieve this is to modify or extend the rendering extension just a tiny bit as described in the MSDN documentation:
Writing Custom Rendering Extensions
Before you decide to create a custom rendering extension, you should evaluate simpler alternatives. You can:
- Create a modified version of an existing rendering extension.
- Customize rendered output by specifying device information settings for existing extensions.
- Add custom formatting and presentation features by combining XSL Transformations (XSLT) with the output of the XML rendering format.
Writing a custom rendering extension is difficult to do as well as to learn.. A rendering extension must typically support all possible combination of report elements. The report object model is extensive (the classes, interfaces, methods, and properties that you must implement number in the hundreds), and the documentation and samples are not yet at a level that can support you through a challenging development project.
If you must render a report in a format that is not included with Reporting Services, you can write your own managed code implementation of a rendering extension. The rendering extension code must implement the IRenderingExtension interface, which is required by the report server. Each of the rendering extensions implemented by Microsoft and shipped with Reporting Services uses a common set of interfaces. This ensures that each extension implements comparable functionality and reduces the complexity of the rendering code in the core of the report server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With