nathanaela / fluentreports Goto Github PK
View Code? Open in Web Editor NEW:page_facing_up: Fluent Reports - Data Driven Reporting Engine for Node.js and Browsers :page_facing_up:
Home Page: https://fluentreports.com
License: MIT License
:page_facing_up: Fluent Reports - Data Driven Reporting Engine for Node.js and Browsers :page_facing_up:
Home Page: https://fluentreports.com
License: MIT License
Let data be
var data = [ { hasProp1: true, hasProp2: false, hasProp3: true }];
var rpt = new fluentreports.Report('buffer');
rpt.data(data)
.margins(20)
.detail("{{hasProp1}} - {{hasProp2}} - {{hasProp3}}");
Will genererate
true - {{hasProp2}} - true
In order to test if a data value exists you might have to use
if (typeof obj.prop !== 'undefined) ...
and not
if (obj.prop) ...
Hi,
I am trying to use fluentreports in my node js project, where I have the following code(which I copied from the readme section) in a file which is used by route.
var Report = require('fluentreports');
module.exports.generateReport = function(next){
var data = [{name: 'Elijah', age: 18}, {name: 'Abraham', age: 22}, {name: 'Gavin', age: 28}];
var rpt = new Report("Report.pdf")
.pageHeader( ["Employee Ages"] ) // Add a simple (optional) page Header...
.data( data ) // Add some Data (This is required)
.detail( [['name', 200],['age', 50]]) // Layout the report in a Grid of 200px & 50px
.render();
}
But when I call the above method, I am getting an error which says
{"message":"Report is not a function","error":{}}
Is this an issue? Or if am using it wrong?
Thanks.
Hello,
can I create pdf/a format using this library??
Thanks.
Any width < 10 for .band related operation fails . I looked in fluentreports.js modified the items I thought would allow for a smaller char cell but no luck.
Thanks
Due to the problem that some CJK characters are not visible with current pdfkit 0.7.2, I would like to be pdfkit updated to the latest version 0.8.0 in package.json of fluentreports package.
"dependencies": {
"pdfkit": "^0.7.2"
},
-->
"dependencies": {
"pdfkit": "^0.8.0"
},
Hi I am creating a report using your package, and thanks for creating this module.
I am trying to generate report, with data like:
data = [
today: "Today",
tomorrow: "Tomorrow",
meta: [
{ value: "One" },
{ value: "Two" },
]
]
So I have created report like this:
rpt = new Report(reportName)
.data(data)
.pageHeader(["Daily Report"])
.header(header)
subRpt = new Report(rpt)
.data(data[0].meta)
.detail(find_outs)
So the problem is I am able to continue the main report after the sub report. I am not sure which function to use to write something after the sub report.
Also, when I add header on sub report, it repeats for each row. Is there a way it can have only one header or section before the sub report.
Is there any documentation for this module other then five examples?
Thanks,
Sanjay
While this runs fine:
var Report = require('fluentreports').Report;
var rpt = new Report();
var options = {};
var header = function (rpt, data) {
rpt.band([
{data: 'Test', width: 82}
]);
};
rpt.header(header);
rpt.data(options);
rpt.render();
adding something with a width <= 2.0 will make it hang permanently:
var Report = require('fluentreports').Report;
var rpt = new Report();
var options = {};
var header = function (rpt, data) {
rpt.band([
{data: 'Test', width: 1},
{data: 'Test', width: 82}
]);
};
rpt.header(header);
rpt.data(options);
rpt.render();
(Can easily be verified on https://npm.runkit.com/fluentreports )
I don't know since when this happens but it worked fine ~2 years ago when I first tried it with the then current version.
I'd like to request the ability to write text rotated a certain number of degrees. I'm not particular about how we do it, perhaps something like print('Some Text', {rotate:90})
. It seems like it would be easiest if this would simply render the text onto the report and leave the Y and X the same as when we started. KellPro is interested in sponsoring this, so shoot me an e-mail with a quote if you'd like to implement this for us.
in the documentation (and also examples) you mention how to set userData
by
rpt.userdata({hi:4})
I noticed it is all lowercase 'userdata' and not camelCase 'userData'
I could not find an example where you were actually using this data in a report or a detail report.
I tried
report.userData.hi
report.userData().hi
...
I do have a use data where I would like to store some data in an object that is accessed later in generating links in the
.details(function(report,data){
var myUserData = report.userData; ??
})
I must be missing something...
Hello,
I tried to use browserify to bundle up fluentreports in a js that can run in the browser, however I ran into some problems. Here's what I did: I installed fluentreports, pdfkit, blob-stream into node.js, then in the fluentreports downloaded directory, I ran:
browserify lib/fluentReports.js -o fr-bundle.js
However, here's what I got:
SyntaxError: Line 92: Unexpected token ILLEGAL while parsing /Users/mar/Downloads/fluentreports-master/node_modules/pdfkit/js/font.js
at Stream.end (/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/index.js:71:21)
at _end (/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/through/index.js:65:9)
at Stream.stream.end (/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/through/index.js:74:5)
at Transform.onend (/usr/local/lib/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js:505:10)
at Transform.g (events.js:180:16)
at Transform.emit (events.js:117:20)
at /usr/local/lib/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js:942:16
at process._tickCallback (node.js:419:13)
I'm very new at node.js, and am not sure whether all node modules can work with browserify. Care to give a hand?
Thanks a lot in advance.
Best regards,
M.
Have ability for grid to auto-size itself depending on the size of all the data.
(Would require pre-rendering system)
This would allow us to do some nifty things like know how many total pages will be rendered; and auto-size grids, auto-wrap parts of grid cells.
However for extremely large reports we might need to make this optional as it would be a lot more memory intensive to pre-render data and hold the stats and/or report parts in memory to do the final rendering...
I haven't had a lot of time yet to play around with fluentreports, but before I spend a lot of time trying to migrate from other solutions, can you explain how the engine handles page breaks for groups of data? Are there options to have the engine dynamically insert page breaks to keep groups from spanning pages? In other words, if I have 9 rendered groups in a report and it can only fit 2 on the first page, 3 on the second, 4 on the third can it automatically do this? Having the ability to prevent a group from spanning pages (assuming a rendered group will fit on a single page) is a necessary feature for my needs.
Also, what is the status of the pre-rendering system you mentioned that would give the ability to have context for things like total number of pages?
I'm not finding this in the documentation. I want to serve this in a web application, not CLI. How do I get the Report Framework to "not" save the PDF locally to the server but send it to the browser in PDF to download for the person viewing the page?
If font is set to "Times-Roman" and fontBold attribute is set true in for example a .band() construct the font face doesn't change. However if font is set to "Helvetica" everything works as expected.
Howto reproduce:
examples/demo2:
var resultReport = new Report(rptName, {font: "c:\\windows\\fonts\\times.ttf"})
.data(mydata)
.totalFormatter(totalFormatter);
resultReport.fontBold();
//REPORTAPI: Error running header in report [TypeError: Cannot read property 'FamilyName' of undefined] TypeError: Cannot read property 'FamilyName' of undefined
this._PDF._font.font.attributes is absent in ttf font
Now I use this code in fluentReports.js:
fontBold: function () {
var font = this._fonts[this._PDF._font.filename || (this._PDF._font.font.attributes && this._PDF._font.font.attributes.FamilyName) || this._PDF._font.name];
//...
In the application i use Report#registerFont
Hello Folks,
Does it supports Arabic language ?! Once I write Arabic it shown stars chars.
And Is it possible to support RTL & LTR direction?!
Thanks :)
I am encountering an issue wherein the final summary overlaps with the page footer. I just want the page footer to be always at the bottom of the page so I set a specific y-coordinate, but sometimes this happens. I cannot upload a sample PDF as it is not supported here. Here is my code instead:
var Report = require('fluentreports').Report;
function constructReport() {
"use strict";
var orderItems = [
{number: 1, description: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Lorem ipsum dolor sit amet, consectetur adipisicing el", quantity: 1, amount: 100, common: 1},
{number: 2, description: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Lorem ipsum dolor sit amet, consectetur adipisicing el", quantity: 1, amount: 100, common: 1},
{number: 3, description: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Lorem ipsum dolor sit amet, consectetur adipisicing el", quantity: 1, amount: 100, common: 1},
{number: 4, description: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Lorem ipsum dolor sit amet, consectetur adipisicing el", quantity: 1, amount: 100, common: 1}
];
var pageHeader = function(report, data) {
report.fontSize(14);
report.setCurrentY(50);
//Company Name, INVOICE
report.band([
{data: "Best Products, Inc.", width: 270, fontBold: true},
{data: "INVOICE", align: 3, width: 260, fontBold: true}
], {border: 0, wrap: 1});
report.fontSize(10);
//Company Address, Invoice Date
report.band([
{data: "#35", width: 270},
{data: "12/01/2013", align: 3, width: 260}
], {border: 0, wrap: 1});
report.band([
{data: "City, State Zip Code", width: 270},
{data: "Invoice #001", align: 3, width: 260}
], {border: 0, wrap: 1});
report.band([
{data: "85-23923-3102923", width: 270},
{data: "12345", align: 3, width: 260}
], {border: 0, wrap: 1});
report.band([
{data: "1232193210-01", width: 530},
], {border: 0, wrap: 1});
report.newLine(5);
}
var detailBondBody = function(report, data) {
report.fontSize(11);
report.band([
{data: data.number, width: 50, align: 2},
{data: data.description, width: 300},
{data: data.quantity, width: 60},
{data: data.amount, width: 120}], {border: 0, width: 0, wrap: 1});
};
var pageFooter = function(report, data) {
//report.newLine();
report.print("Invoice #001", {width: 530, y: 720, align: "right"});
report.print("Company slogan here!", {width: 530, align: "right"});
//report.newLine();
}
var finalSummary = function(report, data) {
report.newLine();
report.band([
{data: "", width: 350},
{data: "Subtotal", width: 60},
{data: "1000", width: 120}], {border: 0, width: 0, wrap: 1});
report.band([
{data: "", width: 350},
{data: "Taxable", width: 60},
{data: "1000", width: 120}], {border: 0, width: 0, wrap: 1});
report.band([
{data: "", width: 350},
{data: "Tax Rate", width: 60},
{data: "1000", width: 120}], {border: 0, width: 0, wrap: 1});
report.band([
{data: "", width: 350},
{data: "Tax Due", width: 60},
{data: "1000", width: 120}], {border: 0, width: 0, wrap: 1});
report.band([
{data: "", width: 350},
{data: "Other", width: 60},
{data: "1000", width: 120}], {border: 0, width: 0, wrap: 1});
report.band([
{data: "", width: 350},
{data: "Total Due", width: 60},
{data: "1000", width: 120}], {border: 0, width: 0, wrap: 1});
}
var report = new Report("issue_overlapping.pdf", {paper: "letter"});
report.pageHeader(pageHeader)
.data(orderItems)
.detail(detailBondBody)
.pageFooter(pageFooter)
.margins(40);
report.groupBy("common")
.footer(finalSummary);
report.printStructure();
var pdf = report.render(function(err, name) {
if (err) {
console.error("Report had an error: ", err);
} else {
console.log("Filename: ", name);
}
});
}
var rpt = constructReport();
I hope you can help me with this. Thank you!
I'm using pageFooter
.
report.pageFooter(footerGenerator);
var footerGenerator = function (reportObject) {
reportObject.fontSize(7);
reportObject.pageNumber({footer: true, align: 'right', text: 'Page {0}'});
reportObject.fontNormal();
};
The page number shows on every page except the final page.
My backend is NodeJS and front end is AngularJS. ERP like system.
http://www.faceinfotech.com/ReportDemo.pdf
This is the invoice in need to generate.
Specially I have a NodeJS REST API. So I need to generate and send this PDF in response call. Is that possible ?
And also do you have the example code of creating a document like invoice ?
Current code will not know how many pages it has to print. Having this ability would allow us to put "page 1 of 10" or "page x of y" on pages.
(Would require a pre-rendering system)
as sanitize html ( ) and more...
var pageHeader = function(r) {
r.fontSize(9);
r.band([
{data: 'Favorite Ice Cream', width: 70, align: 'left'},
{data: 'Least Favorite Ice Cream', width: 70, align: 'right'}
], {fontBold: true, wrap: true});
}
var detail = function(r, row) {
r.fontsize(9);
r.band([
{data: row.favorite, width: 70, align: 'left'},
{data: row.least, width: 70, align: 'right'}
]);
}
var report = new Report("myReport.pdf")
.data([{favorite: 'Butter Pecan', least: 'Pistachio'}])
.pageHeader(pageHeader)
.detail(detail);
Report.render(function(err, name) { console.log("The report was saved to", name); });
In the code in the example above, the least favorite ice cream header is left aligned because it is wrapping. I would like the wrapped text to be right aligned.
Hi, I'm getting this Feedback
REPORTAPI: Your Report's Page Footer exceeds the page bottom margin ( 821.89 ) by 10.110000000000014 -- Please subtract 10.110000000000014 pixels from (probably) where you set Y to 735.89
var rpt = new Report(rp)
.margins({ left:30, top: 30, right: 30, bottom: 30 })
.paper("A4")
.autoPrint(false)
.pageHeader(header)
.data( nt.lotes )
.detail( lotesDetail )
.sum( "valorVenda" )
.pageFooter(summary)
.fontSize(9);
what am I doing wrong?
another question, with align = "justify"
thanks
Font is only possible to set per band in the per-band options for all columns. Not possible to set per band column.
Hi
It would be helpful if all of the examples were already available as pdfs so that someone could see the 'finished' product first to gauge what is possible.
Thanks
Whenever there is a null value in a column, the totals end up NaN. It would be great to have a null/undefined check in the totaling routine.
Hi and cool project here. This is an ambitious project and would love to see this moving.
FYI, we have developed some business programs and uses 3rd party commercial reporting modules.
For the reports, I don't see any way to define labels or boxes and then bind data into them. This will be helpful for (when creating report designer) reports to adjust text-wrapping / auto-grow, etc.
Hi,
What a awesome repo this is, imho designing reports are much better/faster than pdfkit. Is there a way to issue a page break?
TIA
John
Hey, I think this tool is great and we're making good use of it. I did note that your package.json is on 0.0.2 but npm seems not to be aware of anything after 0.0.1. Can you npm publish 0.0.2?
There is a corner case that can cause the paging system to fail and you will not get a footer on current page and/or a header on the next page.
I have a duplicatable case; so this hopefully will be fixed soon..
****** Error on query TypeError: target.hasOwnProperty is not a function
at ReportGroup._expandRowTree (D:\EtiquetesP\node_modules\fluentreports\lib\fluentReports.js:5276:28)
at continueRendering (D:\EtiquetesP\node_modules\fluentreports\lib\fluentReports.js:5057:22)
at groupChangeCallback (D:\EtiquetesP\node_modules\fluentreports\lib\fluentReports.js:5103:21)
at ReportGroup._renderIt (D:\EtiquetesP\node_modules\fluentreports\lib\fluentReports.js:5131:21)
at groupContinue (D:\EtiquetesP\node_modules\fluentreports\lib\fluentReports.js:3811:33)
at renderData (D:\EtiquetesP\node_modules\fluentreports\lib\fluentReports.js:3836:17)
at ReportDataSet._renderIt (D:\EtiquetesP\node_modules\fluentreports\lib\fluentReports.js:3967:17)
at renderGroup (D:\EtiquetesP\node_modules\fluentreports\lib\fluentReports.js:4105:41)
at ReportSection._renderIt (D:\EtiquetesP\node_modules\fluentreports\lib\fluentReports.js:4113:13)
at D:\EtiquetesP\node_modules\fluentreports\lib\fluentReports.js:1227:33 +67ms
The code:
I get the data for the report from a form.
router.post('/', function(req, res, next) {
debug('****** Form Data: \n %O', req.body);
var qry = new dbConfig.PW.Request();
debug('****** Query Insert Eti: ',qrys.qry_insert_eti(req.body));
qry.query(qrys.qry_insert_eti(req.body))
.then(function(next){
var headerFunction = function(Report) {
Report.print("Label", {fontSize: 22, bold: true, underline:true, align: "center"});
Report.newLine(2);
};
var footerFunction = function(Report) {
Report.line(Report.currentX(), Report.maxY()-18, Report.maxX(), Report.maxY()-18);
Report.pageNumber({text: "Page {0} of {1}", footer: true, align: "right"});
Report.print("Printed: "+(new Date().toLocaleDateString()), {y: Report.maxY()-14, align: "left"});
};
var reportdetail = function (Report,data) {
Report.band( [
{data: data.foofield1, width: 50, align: 3, zborder:{left:1, right: 1, top: 0, bottom: 1}}
], {border:1, width: 0, wrap: 1} );
};
var rpt = new Report("EtiquetaP2.pdf")
.margins(20) // Change the Margins to 20 pixels
.pageHeader(headerFunction) // Add a header
.data(req.body) // Add our Data
.detail(reportdetail) // Put how we want to print out the data line.
.pageFooter(footerFunction) // Add a footer
.render();
res.render('newEti', { title: 'Nova Etiqueta' });
})
.catch(function (err) {
debug('****** Error on query', err);
req.body='';
res.render('newEti', { title: 'Nova Etiqueta' });
});
});
I'd like to add a sub-report after each group for a .groupBy()
object. Is that possible?
var nameGroup = rpt.groupBy( "name" )
.header( nameHeader )
.footer( nameFooter );
nameGroup.addReport(subReportObject, data);
Based on the code, it feels like that type of thing should work, but I haven't been successful.
I'm trying to generate a very simple report. Data is coming from mysql db. But, data is not being printed in the generated pdf file. Though header and footer is being printed. Here is the code:
app.post('/adminreport', function(req,res){
var reportDate = req.body.report_Date;
console.log("Report Date : " + reportDate);
connection.connect(function(err){
if(err){
console.log('Error connecting to Db');
return;
}
console.log('Connection established');
});
connection.query('SELECT id, fName, lName, pickUpDate FROM reservations_db WHERE pickUpDate = ?', [reportDate], function(err, results, fields){
if (!err)
{
//res.sendStatus(200).json({status:"ok"});
console.log('The result is generated successfully!');
console.log(results);
//console.log(fields);
var headerFunction = function(Report) {
Report.print("Report By Date", {fontSize: 22, bold: true, underline:true, align: "center"});
Report.newLine(2);
};
var footerFunction = function(Report) {
Report.line(Report.currentX(), Report.maxY()-18, Report.maxX(), Report.maxY()-18);
Report.pageNumber({text: "Page {0} of {1}", footer: true, align: "right"});
Report.print("Report printed: "+ reportDate, {y: Report.maxY()-14, align: "left"});
};
//var res = function(Report) {
// Report.print(results);
//};
var rpt = new Report("report_js.pdf")
.margins(20) // Change the Margins to 20 pixels // Add Data
.pageHeader(headerFunction) // Add a header
.data(results) // Add Data
.pageFooter(footerFunction) // Add a footer
.render();
}
else
{
console.log('Error while performing persistence!');
}
});
This is the generated pdf file:
report_js.pdf
Tried setting it with .font
off the report object, as well as in a band
x.band([{data: 'Sample Data'}], {x: 10, font: 'times'});
Neither method changed the font.
I'm trying to play around with the demo reports, and change the titles, labels e.t.c to a utf8 string. It doesn't seem to work, and displays gibberish.
Is there any way to make it work?
Hi Nathan,
There is a page footer issue if I set the margins on four sides of the page like this:
var report = new Report("test.pdf", {paper: "letter"});
...
report.margins({left: 50, bottom: 5, right: 0, top: 0});
...
The footer size is not being considered when rendering resulting to page footer being printed on the next page.
However, when I set the margins like this:
var report = new Report("test.pdf", {paper: "letter"});
...
report.margins(50);
...
I am not encountering any issue. I hope you can look into this. Thank you!
This is not really an issue. I am trying to save the file on the server and send it as an attachment. At this point I am trying a simple example to make sure it works.
var rpt = new Report("xnReport.pdf")
.pageHeader( ["Employee Ages"] ) // Add a simple (optional) page Header...
.data( data ) // Add some Data (This is required)
// Layout the report in a Grid of 200px & 50px
rpt.outputType( Report.renderType.file );
rpt.render( function (err, name){
if( !err) {
console.log( name + '' + 'saved!!');
}
});
Code runs without an error and I do get the callback console.log but I can't see the file anywhere. What am I doing wrong? Any help is much appreciated.
First off, thank you for the module!
I'm using fluent to creat a report with data tables. I am trying to replace my pdfkit module and I was able to achieve sending a file as response with pdfkit, but not with fluentreports. I can't write the pdf to a file for my project and I know there is something that I am missing. The Report object does take a 'string' or 'object' parameter, but it isn't clear to me how to pass some buffer in and retrieve it once rendered to pass to my response.
Here is what I did for pdfkit:
server.js
server.post('/api/pdf', function createPdf(req, res) {
var theStatement = req.body.statement;
pdf.createPdf( JSON.parse(theStatement), finishPdf );
function finishPdf(err, thePdf) {
if(err){
log.error('err:%j',err);
res.send(err);
}
else {
res.type('pdf');
res.send(thePdf);
}
}
});
pdf module
var _createPdf = function (theStatement, cb) {
var doc = new PDFDocument();
var text = 'Statement..';
var margin = 10;
var top = 0;
var options = {
Title : 'statement.pdf',
Author : 'XXXXX'
};
doc.addPage();
doc.output(function(theDocument){
cb(null, theDocument);
});
};
Here is what I tried for fluentreports:
*same server as above
pdf module:
var _createPdf = function (theStatement, cb) {
var buff = new Buffer(1000);
var r = new report(buff).data({});
r.margins(20)
.pageheader(function(x){x.print('simple page header');});
r.printStructure();
r.render();
cb( null, buff.toString() );
};
How do you supply a buffer?
Thanks again,
Troy
Hello,
by looking at the examples and at fluentReports' code, it is not clear to me whether it is possible to repeat a table header at the beginning of each page, in the case where a table spans multiple pages. Is there such an option?
My idea is to have the header repeat at each page, and also to insert a partial total which is reported at the beginning of each page (say I have a sum on an "amount" field, at the beginning of each page I'd like to know how much that sum is worth at that point).
Thanks,
M.
Hi,
Thanks for your work on this project. I raised some issue when tried to add multiples sub reports on a main report, like this :
var mainReport = new Report('assets/report.pdf')
.data(formData)
.pageheader('test')
.footer('test')
.pageFooter('test');
var overviewReport = new Report(mainReport)
.data(formData)
.titleHeader('title1');
var introductionReport = new Report(mainReport)
.data(formData);
My goal is to use these subreports as "modules", and rendering later only selected subreports in the main report.
When rendering, i get an error on _renderFooter property of children, on line 3927 of fluentReport.js :
_renderFooter: function (Rpt, State, callback) {
var i, cnt = this._children.length, done = -1;
var self = this;
var renderFooterHandler = function () {
done++;
if (done === cnt) {
callback();
} else {
self._children[done]._renderFooter(Rpt, State, renderFooterHandler);
}
};
if (callback) {
renderFooterHandler();
} else {
for (i=0;i<cnt;i++) {
this._children[i]._renderFooter(Rpt, State); //_renderFooter is undefined :(
}
}
},
I tried to use these reports with and without footers, but I can't figure out what I'm doing wrong ; your code seems to basically manage multiple children reports.
Can you give me a sample code of multiple subreports ?
Apart from being able to apply different formats per cell, it would be great if we can also apply different formats inside a single cell.
As an example, I want to print "Steve Jobs_", but I want the asterisk (_) to be of different color and size.
(This can be done with pdfkit by using the "continued" key as parameter in .text() method)
Something like this:
doc.fillColor(‘black’)
.fontSize(10)
.text(“Steve Jobs”, {continued: true, width: 50})
.fontSize(18)
.fillColor(‘red’)
.text(“*”);
I hope this can be available soon! 👍 Thank you Nathan!
Current release is still using the old depreciated pdfkit write/stream interface. So "buffer" function is now broken, and write method throws a warning to the console.
Need to switch code to new stream interface so that it can run on both client and server and so that buffer method is working again..
Currently, the text
for the pageNumber
function is: "Page {0}". I would like to be able to do: "Page {0}/{1}", with {1} being the total number of pages.
Hi,
I think : this._parent = null is needed as per below maybe (in fluentReports.js)?. Else you get an error later: cannot call render on undefined.
function Report(parent, options) {
.......
} else if (typeof parent === "object" && typeof parent.write === "function" && typeof parent.end === "function") {
this._parent = null;
this._outputType = Report.renderType.pipe;
this._pipe = parent;
} else {
Documentation for box indicates:
box ( startX, startY, endX, endY, options)
This led me to assume that the endX
and endY
options were a fixed point on the page. They appear to actually be width & height values.
It'd more correctly be:
box ( startX, startY, boxWidth, boxHeight, options)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.