{"action":"created","issue":{"url":"https://api.github.com/repos/tojocky/node-printer/issues/101","labels_url":"https://api.github.com/repos/tojocky/node-printer/issues/101/labels{/name}","comments_url":"https://api.github.com/repos/tojocky/node-printer/issues/101/comments","events_url":"https://api.github.com/repos/tojocky/node-printer/issues/101/events","html_url":"https://github.com/tojocky/node-printer/issues/101","id":121019058,"number":101,"title":"Convert Blob data to Raw buffer in javascript or node","user":{"login":"kamaldeepoodles","id":10527158,"avatar_url":"https://avatars.githubusercontent.com/u/10527158?v=3","gravatar_id":"","url":"https://api.github.com/users/kamaldeepoodles","html_url":"https://github.com/kamaldeepoodles","followers_url":"https://api.github.com/users/kamaldeepoodles/followers","following_url":"https://api.github.com/users/kamaldeepoodles/following{/other_user}","gists_url":"https://api.github.com/users/kamaldeepoodles/gists{/gist_id}","starred_url":"https://api.github.com/users/kamaldeepoodles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kamaldeepoodles/subscriptions","organizations_url":"https://api.github.com/users/kamaldeepoodles/orgs","repos_url":"https://api.github.com/users/kamaldeepoodles/repos","events_url":"https://api.github.com/users/kamaldeepoodles/events{/privacy}","received_events_url":"https://api.github.com/users/kamaldeepoodles/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tojocky/node-printer/labels/invalid","name":"invalid","color":"e6e6e6"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-12-08T14:33:27Z","updated_at":"2015-12-10T06:44:29Z","closed_at":"2015-12-09T17:07:08Z","body":"I am using a plugin jsPDF (https://github.com/MrRio/jsPDF) which generates PDF and saves it to local file system. Now in jsPDF.js, there is some piece of code which generates pdf data in blob format as:-\r\n\r\nvar blob = new Blob([array], {type: \"application/pdf\"});\r\n\r\nand further saves the blob data to local file system. Now instead of saving I need to print the PDF using plugin node-printer.\r\n\r\nHere is some sample code to do so\r\n\r\nvar fs = require('fs'),\r\nvar dataToPrinter;\r\n\r\nfs.readFile('/home/ubuntu/test.pdf', function(err, data){\r\n    dataToPrinter = data;\r\n}\r\n\r\nvar printer = require(\"../lib\");\r\nprinter.printDirect({\r\n    data: dataToPrinter,\r\n    printer:'Deskjet_3540',\r\n    type: 'PDF',\r\n    success: function(id) {\r\n        console.log('printed with id ' + id);\r\n    },\r\n    error: function(err) {\r\n        console.error('error on printing: ' + err);\r\n    }\r\n})\r\nThe fs.readFile() reads the PDF file and generates data in raw buffer format.\r\n\r\nNow what I want is to convert the 'Blob' data into 'raw buffer' so that I can print the PDF."},"comment":{"url":"https://api.github.com/repos/tojocky/node-printer/issues/comments/163516469","html_url":"https://github.com/tojocky/node-printer/issues/101#issuecomment-163516469","issue_url":"https://api.github.com/repos/tojocky/node-printer/issues/101","id":163516469,"user":{"login":"tojocky","id":598809,"avatar_url":"https://avatars.githubusercontent.com/u/598809?v=3","gravatar_id":"","url":"https://api.github.com/users/tojocky","html_url":"https://github.com/tojocky","followers_url":"https://api.github.com/users/tojocky/followers","following_url":"https://api.github.com/users/tojocky/following{/other_user}","gists_url":"https://api.github.com/users/tojocky/gists{/gist_id}","starred_url":"https://api.github.com/users/tojocky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tojocky/subscriptions","organizations_url":"https://api.github.com/users/tojocky/orgs","repos_url":"https://api.github.com/users/tojocky/repos","events_url":"https://api.github.com/users/tojocky/events{/privacy}","received_events_url":"https://api.github.com/users/tojocky/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T06:44:29Z","updated_at":"2015-12-10T06:44:29Z","body":"Buffer now is the same as ArrayBuffer, early versions of node (<=0.12) it was a simple C++ memory allocation. This may not work with early version of node."}}