From f55fd08284ab1934b58afae67d0c944b24bc95a0 Mon Sep 17 00:00:00 2001 From: Jacob Date: Mon, 8 Oct 2018 13:15:28 +0200 Subject: [PATCH] Reformat sample --- samples/PDFServer.js | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/samples/PDFServer.js b/samples/PDFServer.js index ae3ded46..98034184 100644 --- a/samples/PDFServer.js +++ b/samples/PDFServer.js @@ -1,27 +1,25 @@ var express = require('express'); var app = express(); +app.get('/', function(req, res) { + res.writeHead(200, { 'Content-Type': 'application/pdf' }); -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 ' + (req.query.id ? req.query.id : 'World'), - 0,400, - { - font:pdfWriter.getFontForFile('../tests/TestMaterials/fonts/arial.ttf'), - size:50, - colorspace:'gray', - color:0x00 - }); - pdfWriter.writePage(page); - pdfWriter.end(); - - res.end(); - + 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 ' + (req.query.id ? req.query.id : 'World'), 0, 400, { + font: pdfWriter.getFontForFile('../tests/TestMaterials/fonts/arial.ttf'), + size: 50, + colorspace: 'gray', + color: 0x00 }); + pdfWriter.writePage(page); + pdfWriter.end(); + + res.end(); +}); -app.listen(3000); \ No newline at end of file +app.listen(3000);