Page 1 of 2

Issue: Image not updated on re-render

Posted: Tue Jun 20, 2017 8:05 am
by lega
If report contains two images, bound using dataURL, the second one(maybe even all, not tested this) is cached somewhere in report global code. If then another instance of same report is rendered in same browser session, the newly rendered report will contain old image.

Our real word scenario, we have ability for user to see and sign an order report on-screen. We should re-render it after it's signed (or re-signed). Due to this bug the first rendered signature image is cached forever, even if opened with another order data.

The attached archive contains designer and viewer for the issue. Just hit render multiple times. For sake of this example unique image is generated using canvas and counter.
Each canvas is left in document for debug purposes, this shows that image rendered on report is not same as image provided via report data.

There is also a repro without issue, when the first (in this case static) image is removed from report definition, the second image is updated fine on every re-render.

Hope it will help to fix the issue. Thanks!

Re: Issue: Image not updated on re-render

Posted: Wed Jun 21, 2017 9:32 am
by Alex K.
Hello,

Please try to use the async methods for rendering and exporting:

Code: Select all

var report = new Stimulsoft.Report.StiReport();
report.loadFile("reports/test.mrt");
report.render();
var settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
// Create an PDF service instance.             
var service = new Stimulsoft.Report.Export.StiPdfExportService();
// Create a MemoryStream object.             
var stream = new Stimulsoft.System.IO.MemoryStream();
// Export PDF using MemoryStream.             
service.exportToAsync(function () {                 
    var data = stream.toArray();                 
    // Get report file name                 
    var fileName = String.isNullOrEmpty(report.reportAlias) ? report.reportName : report.reportAlias;         
    // Save data to file                 
    Object.saveAs(data, fileName + ".pdf", "application/pdf");
}, report, stream, settings);
Thank you.

Re: Issue: Image not updated on re-render

Posted: Mon Jun 26, 2017 12:20 pm
by lega
Hi Aleksey, thanks for the reply.

Still no luck. I'm getting the same results with async. Here is my rendering code:

Code: Select all

function renderViaAsyncExport(report) {
	var settings = new Stimulsoft.Report.Export.StiHtmlExportSettings();			
	var service = new Stimulsoft.Report.Export.StiHtmlExportService();
	var textWriter = new Stimulsoft.System.IO.TextWriter();
	var htmlTextWriter = new Stimulsoft.Report.Export.StiHtmlTextWriter(textWriter);

	report.render();    
	service.exportToAsync(function () {  
		var html = textWriter.getStringBuilder().toString();
		document.getElementById("viewer-content").innerHTML = html;
	}, report, htmlTextWriter, settings);
}
Repro attached, see no-issue_viewer.html.

Re: Issue: Image not updated on re-render

Posted: Mon Jun 26, 2017 12:25 pm
by lega
Just thinking now ... I'm not sure how doing async would have helped in the first place. Only if async methods were more maintained than the sync ones. Which would be weird, wouldn't it?

Re: Issue: Image not updated on re-render

Posted: Fri Jun 30, 2017 1:21 pm
by Alex K.
Hello,

Sorry for the delay with response.

We need some additional time to investigate the issue.

Thank you.

Re: Issue: Image not updated on re-render

Posted: Mon Jul 03, 2017 9:49 am
by lega
Hi Aleksey, sure, take your time. Hope it will get fixed soon.

Thanks for the response.

Re: Issue: Image not updated on re-render

Posted: Tue Jul 04, 2017 11:31 am
by Alex K.
Hello,

Thank you for the detailed information.
We have found some bugs. We will try to fix it fast as possible.

Thank you.

Re: Issue: Image not updated on re-render

Posted: Tue Dec 12, 2017 10:00 am
by lega
Hi guys,

It's been almost 6 months. We recently tried with the new (2018.1) version, but sadly the issue still exists. Attached is simplified reproduction of the issue.
Can someone take another look please?

To use it, just run

Code: Select all

node server.js
And navigate to http://127.0.0.1:8125

The reproduction is as isolated and minimal as possible.

Thanks

Re: Issue: Image not updated on re-render

Posted: Thu Dec 14, 2017 2:49 pm
by HighAley
Hello.

We are very sorry for such delay with answer.
We have reproduced the issue and can't find where is comes from.
We will look at this issue more deeper and will let you know about results.

Thank you.

Ticket reference: #4505

Re: Issue: Image not updated on re-render

Posted: Thu Mar 15, 2018 11:55 am
by Vadim
Hello.
It will be fixed from next version (2018.1.9).
Plase clear cache before rendering

Code: Select all

...
Stimulsoft.Report.StiFileImageCache.clear();
report.render();