Skip to content

Commit

Permalink
added pdfkit, brfs, blob-stream
Browse files Browse the repository at this point in the history
  • Loading branch information
zjrosen1 committed Aug 26, 2015
1 parent 6c4754c commit f8148ee
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
Do beats have a type? Character or Plot?
*/

import "./testPDF";
import "./speech";
import "./contextmenu";
import "./awesomplete";
Expand Down
24 changes: 24 additions & 0 deletions assets/js/testPdf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// require dependencies
var PDFDocument = require('pdfkit');
var blobStream = require('blob-stream');

// create a document the same way as above
var doc = new PDFDocument();

console.log(doc);
// pipe the document to a blob
var stream = doc.pipe(blobStream());

// add your content to the document here, as usual

// get a blob when you're done
doc.end();
stream.on('finish', function() {
// get a blob you can do whatever you like with
var blob = stream.toBlob('application/pdf');

// or get a blob URL for display in the browser
var url = stream.toBlobURL('application/pdf');
iframe.src = url;
});

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
"license": "BSD",
"devDependencies": {
"babelify": "^6.1.3",
"blob-stream": "^0.1.3",
"brfs": "^1.4.1",
"browser-sync": "^2.8.0",
"browserify": "^11.0.0",
"bs-snippet-injector": "^2.0.1",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^2.3.1",
"gulp-awspublish": "^2.0.2",
"gulp-babel": "^5.1.0",
"gulp-clean": "^0.3.1",
"gulp-coffee": "^2.3.1",
Expand All @@ -29,8 +32,8 @@
"gulp-uglify": "^1.2.0",
"gulp-util": "^3.0.5",
"jshint-stylish": "^2.0.1",
"vinyl-source-stream": "^1.1.0",
"gulp-awspublish": "^2.0.2"
"pdfkit": "^0.7.1",
"vinyl-source-stream": "^1.1.0"
},
"dependencies": {
"gulp-install": "^0.5.0"
Expand Down

0 comments on commit f8148ee

Please sign in to comment.