galkahana / HummusJS

Node.js module for high performance creation, modification and parsing of PDF files and streams
http://www.pdfhummus.com
Other
1.14k stars 169 forks source link

Is the example still valid? I am getting a blank page #281

Closed hirejohnsalcedo closed 6 years ago

hirejohnsalcedo commented 6 years ago
var express = require("express");
var app = express();

app.get("/", function(req, res) {
    res.writeHead(200, { "Content-Type": "application/pdf" });
    var hummus = require("hummus");
    var pdfWriter = hummus.createWriter(new hummus.PDFStreamForResponse(res));
    var page = pdfWriter.createPage(0, 0, 595, 842);
    pdfWriter
        .startPageContentContext(page)
        .writeText("Hello", 0, 400, {
            size: 50,
            color: 0xff0000,
        });
    pdfWriter.writePage(page);
    pdfWriter.end();
    res.end();
});

app.listen(3000);

image

galkahana commented 6 years ago

that aint the example. yes. the example is still valid.