@@ -14,6 +14,8 @@ var sjcl = require('sjcl');
14
14
var stringify = require ( "json-stringify-pretty-compact" ) ;
15
15
var waitUntil = require ( 'wait-until' ) ;
16
16
var nodemailer = require ( 'nodemailer' ) ;
17
+ var pdf = require ( 'html-pdf' ) ;
18
+
17
19
const execSync = require ( 'child_process' ) . execSync ;
18
20
const syncClient = require ( 'sync-rest-client' ) ;
19
21
@@ -136,6 +138,7 @@ app.use("/sjcl.js", express.static(__dirname + "/lib/sjcl.js"));
136
138
app . use ( "/swal-forms.js" , express . static ( __dirname + "/lib/swal-forms.js" ) ) ;
137
139
app . use ( "/swal-forms.css" , express . static ( __dirname + "/lib/swal-forms.css" ) ) ;
138
140
app . use ( "/images" , express . static ( __dirname + "/images" ) ) ;
141
+ app . use ( "/report" , express . static ( __dirname + "/report" ) ) ;
139
142
140
143
app . get ( '/' , function ( req , res ) {
141
144
response_client_html ( res , "templatemo_485_rainbow/index.html" ) ;
@@ -452,6 +455,23 @@ app.post('/query-by-chaincodes', function(req, res) {
452
455
453
456
} ) ;
454
457
458
+ app . post ( '/create-verification-report' , function ( req , res ) {
459
+ logger . info ( "create-verification-report" ) ;
460
+
461
+ var outputhtml = req . body . outputhtml ;
462
+ var reportID = req . body . reportID ;
463
+ var options = { format : 'Letter' } ;
464
+ var pdfPath = "/report/" + "veri-report" + ( new Date ( ) . toString ( ) ) + ".pdf" ;
465
+ var pdfPathFull = __dirname + pdfPath ;
466
+
467
+ pdf . create ( outputhtml , options ) . toFile ( pdfPathFull , function ( err , pdfRes ) {
468
+ if ( err ) return console . log ( err ) ;
469
+ logger . info ( pdfPath ) ;
470
+ res . write ( pdfPath ) ;
471
+ res . end ( ) ;
472
+ } ) ;
473
+ } ) ;
474
+
455
475
app . post ( '/query-by-block-by-number' , function ( req , res ) {
456
476
457
477
} ) ;
0 commit comments