Runtime Image Watermark
Posted: Fri Nov 02, 2018 5:14 am
I'm trying to use the watermark as a means of making my reports look more professional. We plan to render, via professional artists, different themes that are most likely SVG files. The best way I can accomplish this is using (on a 8.5 x 11 inch page) an image that is rendered to take up the entire printable area to server as a background.
This is the basic code I'm using, it loads the image, I can see it loaded into the report object via console.log() but nothing displays. Is this intended, a bug, or me not coding this right? When I use the editor Watermark dialog and load the image with its options, it saves the image as base64 encode, however when loaded thru the browser it doesn't show either. If I preview the report inside the Editor, it shows as advertised. If there is another or easier way to accomplish this I'm open to suggestions.
Using the following code to try to load it:
This is the basic code I'm using, it loads the image, I can see it loaded into the report object via console.log() but nothing displays. Is this intended, a bug, or me not coding this right? When I use the editor Watermark dialog and load the image with its options, it saves the image as base64 encode, however when loaded thru the browser it doesn't show either. If I preview the report inside the Editor, it shows as advertised. If there is another or easier way to accomplish this I'm open to suggestions.
Using the following code to try to load it:
Code: Select all
var options = new Stimulsoft.Viewer.StiViewerOptions({showTooltips:false});
var viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
var report = new Stimulsoft.Report.StiReport({isAsyncMode: true});
report.loadFile("Backgroundimg.mrt");
var page = report.pages.getByIndex(0)
page.watermark.image = Stimulsoft.System.Drawing.Image.fromFile('header.png')
page.watermark.aspectRatio = true
page.watermark.imageStretch = true
page.watermark.imageShowBehind= true
report.renderAsync(function () {
viewer.report = report;
viewer.renderHtml("viewerContent");
})