const paths = require('path'); const mv = require('mv'); const fs = require('fs'); const htmlPdf = require('html-pdf-chrome'); const options = { port: 42020, printOptions:{ marginBottom: 0, marginLeft: 0, marginTop: 0, marginRight: 0 } }; file = process.argv[2]; filename = file.substring(42,file.length-4); //C:/node/node.exe C:/inetpub/wwwroot/spooler_db/test.js C:/inetpub/wwwroot/spooler_db/process_pdf/01221200963.html //url = "file://C:/inetpub/wwwroot/spooler_db/process_pdf/"+paths.basename(path); //url = "file://C:/inetpub/wwwroot/spooler_db/"+file; url = "file://"+file; htmlPdf.create(url, options).then((pdf) => pdf.toFile("C:\\inetpub\\wwwroot\\spooler_db\\process_pdf\\"+filename+"pdf")); //htmlPdf.create(url, options).then((pdf) => pdf.toFile("C:\\inetpub\\wwwroot\\spooler_db\\test_done\\"+filename+".pdf")).then( function(err) { /* mv(file, "test_done/"+filename , function (err) { if (err) throw err; }) */ //});