I think I found the issue.
Missing resources not copied when the solution is generated (Do not copy / Copy if newest) if Visual Studio.
The error isn't explicit but after a bit of research, I get it.
Best regards,
Stéphane
I think I found the issue.
Missing resources not copied when the solution is generated (Do not copy / Copy if newest) if Visual Studio.
The error isn't explicit but after a bit of research, I get it.
Best regards,
Stéphane
Hi there,
We encounter a weird issue with the PDF report generation. Everything works fine on windows but we try to setup or production server to test in real condition. The PDF report are generated but the CSS doesn't seem to work correctly, we mainly have raw HTML and assets doesn't seems to work.
In the logs, we get this error :
2018-05-28T11:13:17.162Z - warn: ReferenceError: Can't find variable: $ timestamp=Mon May 28 2018 13:13:17 GMT+0200 (CEST), requestId=1
2018-05-28T11:13:17.162Z - warn: file:///%2Ftmp%2F1e6d4ac0-6268-11e8-b351-8d316307a3fahtml.html : 217 timestamp=Mon May 28 2018 13:13:17 GMT+0200 (CEST), requestId=1
We try to force the tempDirectory, not to avail.
Do you have any idea of what cause this issue and how to solve it?
Best regards,
Stéphane
Hi,
I'm currently working on a new template which use the text recipe to generate a csv file. (.Net core 2)
I've checked online and on the Text recipe page (https://jsreport.net/learn/text) which parameters I have to use but the names to use aren't present.
I'm guessing that I should do something like this :
{
"recipe": "text",
"engine": "handlebars",
"text": {
"content-type": "text/csv",
"file-extension": "csv",
"content-disposition": "inline"
}
}
Moreover, I use accented characters in my csv file, how can I specify an utf8 encoding?
If you find some spare time, it would be great to reference a full configuration file with all possible options, as for now information is scatterred here and there and some are missing. (Expanding this page would be awesome : https://jsreport.net/learn/configuration)
Thank you in advance,
Stéphane
Well, this is rather strange.
Here is my header :
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body>
<style>
{#asset CallRatio header.css @encoding=utf8}
</style>
<div class="header-box">
<table cellpadding="0" cellspacing="0" class="header">
<tr class="logos">
<td><img src="../jsreport/data/assets/General%20Kiwix.png/content.png" /></td>
<td>{{Report.Name}}</td>
<td><img src="{#asset General Kiwix.png @encoding=dataURI}" /></td>
</tr>
</table>
</div>
</body>
</html>
The first image render correctly in the pdf, the second one doesn't appear. I guess it's a path issue but I can't figure how to fix it. Any lead? (config / assets / publicAccessEnabled is at true and the files exists, of course)
Thanks,
Stéphane
Hi,
Thanks, I missed this issue article and fix, I'll check it out.
Thanks again for your quick answer. :-)
Stéphane
Hello,
I'm trying to insert image in jsreport (PDF) with the following header template :
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body>
<style>
{#asset CallRatio header.css @encoding=utf8}
</style>
<div class="header-box">
<table cellpadding="0" cellspacing="0" class="header">
<tr class="logos">
<td><img src="{#asset General Thelis.png @encoding=dataURI}" /></td>
<td>{{Report.Name}}</td>
<td><img src="{#asset General Kiwix.png @encoding=dataURI}" /></td>
</tr>
</table>
</div>
</body>
</html>
But the images aren't displayed in the PDF, no error in logs, so I'm a bit lost here.
The images appear in the generated html header (%TEMP%/jsreport) but when phantomjs generate the pdf, no image are visible.
Any idea how to debug/solve this?
Thanks,
Stéphane
Thank you very much, I missed this config option. Performance of jsreport are really good btw.
Have a good day,
Stéphane
Hi,
I've found an bug with .net RenderByNameAsync method :
You define classes with Uppercase letters for properties like :
public class Data
{
public List<SubData> DataList { get; set; }
}
public class SubData
{
public string Message { get; set; }
}
Then you pass an object create from this class to RenderByNameAsync like this :
//d is an instanciated Data object.
var results = service.RenderByNameAsync ("TplName", d);
Template replacement will recognize DataList member as datalist (lowercase) but it won't recognize Message. To solve the issue, you should lowercase all members of the SubData class. Or you can convert all to Json which will solve the issue.
This is rather annoying when you use naming conventions and use uppercase in properties' names.
Regards,
Stéphane
Hi,
Thanks for your quick answer. I've made a test with 100.000 records and I received an error : "Unable to render template. request entity too large".
Is there a limit of size of the data we pass to the Render method?
Stéphane
Thanks, logs are working now.
And I finally get everything working, I put the initialization in Startup.cs, as a WebServer, and it seems to work without issue.
Moreover, where can I find the log. I can only access Exception content but can't find any log file. Does the default config with jsreport.Local includes logs, and if not, how can I set them up?
Thanks,
Stéphane
Hi,
I would like to know if jsreport can handle a huge set of data and how to avoid long loading time?
We have to generate reports with hundreds of pages and we want to avoid loading all data in memory, so we need some way to generate the report page per page. We though of using and yield on the IENumerable to fetch the data record by record, will it work with jsreport? If not, is there any other solution?
Best regards,
Stéphane
A little update :
I've setup the solution @home and no more error. I guess it should be related to the licence and max number of templates.
How does it work, as for now, I only have one template defined? (Even if I've made multiple various tmeplates tests, like the samples and some personal testing)
It looks like the check to avoid using more than 5 templates is generating the error, and the error is quite unclear here.
Thanks in advance,
Stéphane
Hi there,
I've started to use jsreport a few days ago, as we plan to include it into our reporting solution.
I've encountered some issues and many I can find some help here.
I'm working with VS 2017, .Net Core 2 Web Api project.
I've installed nuget jsreport packages (Local, Shared, Types and Binaries for OSX, Linux et Windows).
I've only one Template defined, but I've made a lot of testing. I'm wondering if the issue is not related to the 5 max templates for on premise jsreport. I'm also unable to find any log file anywhere, but there should be some logs by default, right?
Anyway, I get the following error :
Error: An error occurred while trying to execute the command: at onCriticalError ([eval]:29603:25) at [eval]:29558:13 at tryCatcher ([eval]:36038:23) at Promise._settlePromiseFromHandler ([eval]:34061:31) at Promise._settlePromise ([eval]:34118:18) at Promise._settlePromise0 ([eval]:34163:10) at Promise._settlePromises ([eval]:34238:18) at Async._drainQueue ([eval]:31008:16) at Async._drainQueues ([eval]:31018:10) at Immediate.Async.drainQueues [as _onImmediate] ([eval]:30892:14) at processImmediate [as _immediateCallback] (timers.js:396:17) {"originalError":{}}(Original) Error: An error occurred while trying to start daemonized process: An error has occurred when trying to initialize jsreport.. at null.<anonymous> ([eval]:30773:13) at listener ([eval]:8172:10) at EventEmitter.emit ([eval]:8260:22) at onData ([eval]:85844:8) at Lazy.<anonymous> ([eval]:51354:13) at Lazy.<anonymous> ([eval]:51336:19) at emitTwo (events.js:87:13) at Lazy.emit (events.js:172:7) at Lazy.<anonymous> ([eval]:51337:22) at emitOne (events.js:77:13) at Lazy.emit (events.js:169:7) at yieldTo ([eval]:51444:18) at Function.<anonymous> ([eval]:51482:27) at Lazy.<anonymous> ([eval]:51450:21) at emitOne (events.js:77:13) at Lazy.emit (events.js:169:7) at Socket.<anonymous> ([eval]:51313:22) at emitNone (events.js:67:13) at Socket.emit (events.js:166:7) at emitReadable (_stream_readable.js:419:10) at emitReadable (_stream_readable.js:413:7) at readableAddChunk (_stream_readable.js:164:13) {}
Here is my GenerateDocument method :
private string GenerateDocument<T>(EDocumentFormat format, string documentPath, string documentName, IEnumerable<T> data)where T : IApiData
{
Report report = null;
byte[] FileData = new byte[] { };
string GeneratedFilePath = string.Empty;
IReportingBinary BinaryToUse = null;
//ILocalWebServerReportingService service = null;
ILocalUtilityReportingService service = null;
try
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
BinaryToUse = jsreport.Binary.JsReportBinary.GetBinary();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
BinaryToUse = jsreport.Binary.Linux.JsReportBinary.GetBinary();
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
BinaryToUse = jsreport.Binary.OSX.JsReportBinary.GetBinary();
switch (format)
{
case EDocumentFormat.Pdf:
service = new LocalReporting()
.RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "jsreport"))
.KillRunningJsReportProcesses()
.UseBinary(BinaryToUse)
.Configure(cfg => cfg.AllowLocalFilesAccess().FileSystemStore().BaseUrlAsWorkingDirectory())
.AsUtility()
.Create();
/*service = new LocalReporting()
.UseBinary(BinaryToUse)
.KillRunningJsReportProcesses()
.RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "jsreport"))
.Configure(cfg => cfg.AllowLocalFilesAccess().FileSystemStore().BaseUrlAsWorkingDirectory())
.AsWebServer()
.RedirectOutputToConsole()
.Create();
service.StartAsync().Wait();*/
string documentNamePdf = $"{documentName}.pdf";
string Json = $"{{\"items\": {JsonConvert.SerializeObject(data)}}}";
report = service.RenderByNameAsync("Call", data).Result;
if (report != null && report.Content != null)
{
using (var fileStream = System.IO.File.Create(Path.Combine(FilePath, documentNamePdf)))
{
report.Content.CopyToAsync(fileStream);
}
}
GeneratedFilePath = Path.Combine(FilePath, documentNamePdf);
break;
case EDocumentFormat.Csv:
documentName = $"{documentName}.csv";
break;
case EDocumentFormat.Rtf:
documentName = $"{documentName}.rtf";
break;
}
return GeneratedFilePath;
}
catch (Exception ex)
{
Console.WriteLine($"Error : {ex}");
return string.Empty;
}
finally
{
if (service != null)
service.KillAsync().Wait();
BinaryToUse = null;
FileData = null;
service = null;
}
}
Please note that I can start and run jsreport from command line, from "Temp\jsreport\dotnet\binary-default-1.10.0.0".
I hope someone could help me.
regards,
Stéphane