Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (!error) {
- try {
- var result = JSON.parse(fs.readFileSync(phantomJsExecPath + '/result' + objectId + '.json').toString());
- fs.unlinkSync(phantomJsExecPath + '/result' + objectId + '.json');
- if ( fs.existsSync(phantomJsExecPath + "/devis" + objectId + ".pdf") ) {
- var original_data = fs.readFileSync(phantomJsExecPath + "/devis" + objectId + ".pdf");
- result.devis = new Buffer(original_data, 'binary').toString('base64');
- fs.unlinkSync(phantomJsExecPath + '/devis' + objectId + '.pdf');
- }
- if (fs.existsSync(phantomJsExecPath + "/specimen" + objectId + ".pdf")) {
- pdfToImage("specimen" + objectId + ".pdf", "devis" + objectId + ".jpg", function (base64) {
- result.image = base64;
- res.json({ error: false, result: result });
- });
- }
- else
- res.json({ error: false, result: result });
- } catch (e) {
- console.log(e);
- var bitmap = fs.readFileSync(capturePath);
- res.json({
- error: true,
- error_message: e,
- screenshot: new Buffer(bitmap).toString('base64')
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement