Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #18 from 340CT-1920SEPJAN/develop
Develop
- Loading branch information
Showing
11 changed files
with
6,260 additions
and
2,566 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -6,7 +6,7 @@ module.exports = { | ||
port: 8080, | ||
}, | ||
launch: { | ||
headless: false, | ||
headless: true, | ||
devtools: true, | ||
timeout: 30000 | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* eslint-disable no-magic-numbers */ | ||
/* eslint-disable max-lines-per-function */ | ||
'use strict' | ||
|
||
const pdf = require('/home/cc/Documents/340CT_Project/node_modules/pdf/lib/pdf').pdf | ||
const fs = require('fs') | ||
|
||
module.exports = class Order { | ||
|
||
createPDF(data) { | ||
console.log('data = ', data) | ||
const doc = new pdf() | ||
doc.text(20, 20, 'Menu') | ||
doc.text(20, 30, 'Name') | ||
doc.text(100, 30, 'Type') | ||
doc.text(140, 30, 'Price') | ||
let line = 40 | ||
for(let i = 0; i< data.itemName.length; i++) { | ||
doc.text(20, line, data.itemName[i]) | ||
doc.text(100, line, data.itemType[i]) | ||
doc.text(140, line,`£ ${data.itemPrice[i]}`) | ||
line = line + 10 | ||
} | ||
doc.setProperties({ | ||
title: 'Menu', | ||
subject: 'Items in the current Menu', | ||
author: 'User', | ||
keywords: 'Menu, Restaurant, Price,', | ||
creator: 'User'}) | ||
doc.addPage() | ||
//doc.setFontSize(22) | ||
//doc.text(20, 20, 'This is a title') | ||
//doc.setFontSize(16) | ||
//doc.text(20, 30, 'This is some normal sized text underneath.') | ||
const fileName = `testFile${new Date().getSeconds()}.pdf` | ||
// eslint-disable-next-line handle-callback-err | ||
fs.writeFile(fileName, doc.output(), (err, data) => { | ||
console.log(`${fileName } was created! great success!`) | ||
}) | ||
} | ||
} |
Oops, something went wrong.