diff --git a/docs/Embedding-pdf.md b/docs/Embedding-pdf.md index b68792e9..aa84fa67 100644 --- a/docs/Embedding-pdf.md +++ b/docs/Embedding-pdf.md @@ -43,7 +43,7 @@ The method call looks like this: pdfWriter.createFormXObjectsFromPDF( inSourceFilePath, [inFormBox || inSourcePageBoxEnum], - [inPageRangeObject] + [inPageRangeObject], ); ``` @@ -72,7 +72,7 @@ You create a copying context for a source PDF using the following PDFWriter meth ```javascript var cpyCxt = pdfWriter.createPDFCopyingContext( - inSourceFilePDF || inSourceFileStream + inSourceFilePDF || inSourceFileStream, ); ``` @@ -90,7 +90,7 @@ The following methods are available for these purposes: cpyCxt.appendPDFPageFromPDF(inSourcePageIndex); cpyCxt.createFormXObjectFromPDFPage( inSourcePageIndex, - inFormBox || inPageBoxEnum + inFormBox || inPageBoxEnum, ); cpyCxt.mergePDFPageToPage(inTargetPage, inSourcePageIndex); cpyCxt.mergePDFPageToFormXObject(inTargetForm, inSourcePageIndex); diff --git a/docs/Show-images.md b/docs/Show-images.md index a51c1aea..265db4f6 100644 --- a/docs/Show-images.md +++ b/docs/Show-images.md @@ -56,7 +56,7 @@ Usually you'd like to draw frames around images, or fit them. For this you'll ne ```javascript var jpgDimensions = pdfWriter.getImageDimensions( - "./TestMaterials/Images/soundcloud_logo.jpg" + "./TestMaterials/Images/soundcloud_logo.jpg", ); ``` @@ -76,7 +76,7 @@ To create and use a PDF image object from a JPG do the following: ```javascript var imageXObject = pdfWriter.createImageXObjectFromJPG( - "./TestMaterials/images/otherStage.JPG" + "./TestMaterials/images/otherStage.JPG", ); var cxt = pdfWriter.startPageContentContext(page); cxt.q().cm(500, 0, 0, 400, 0, 0).doXObject(imageXObject).Q(); @@ -96,7 +96,7 @@ If you don't wish to have an image object, but would rather a form object, that ```javascript var formXObject = pdfWriter.createFormXObjectFromJPG( - "./TestMaterials/images/otherStage.JPG" + "./TestMaterials/images/otherStage.JPG", ); ``` diff --git a/lib/PDFRStreamForBuffer.js b/lib/PDFRStreamForBuffer.js index e81c25ea..8425cc28 100644 --- a/lib/PDFRStreamForBuffer.js +++ b/lib/PDFRStreamForBuffer.js @@ -14,7 +14,7 @@ function PDFRStreamForBuffer(buffer) { PDFRStreamForBuffer.prototype.read = function (inAmount) { var amountToRead = inAmount; var arr = Array.from( - this.buffer.subarray(this.rposition, this.rposition + amountToRead) + this.buffer.subarray(this.rposition, this.rposition + amountToRead), ); this.rposition += amountToRead; return arr; diff --git a/lib/Recipe.js b/lib/Recipe.js index 17628b3b..f9a2d530 100644 --- a/lib/Recipe.js +++ b/lib/Recipe.js @@ -79,7 +79,7 @@ class Recipe { this.output, Object.assign({}, this.encryptOptions, { version: this._getVersion(this.options.version), - }) + }), ); } else { this.read(); @@ -90,7 +90,7 @@ class Recipe { new muhammara.PDFStreamForResponse(this.outStream), Object.assign({}, this.encryptOptions, { log: this.logFile, - }) + }), ); } else { this.writer = muhammara.createWriterToModify( @@ -98,7 +98,7 @@ class Recipe { Object.assign({}, this.encryptOptions, { modifiedFilePath: this.output, log: this.logFile, - }) + }), ); } } catch (err) { @@ -122,7 +122,7 @@ class Recipe { get position() { const { ox, oy } = this._reverseCoordinate( this._position.x, - this._position.y + this._position.y, ); return { x: ox, @@ -222,7 +222,7 @@ class Recipe { new muhammara.PDFStreamForResponse(this.outStream), Object.assign({}, this.encryptOptions, { log: this.logFile, - }) + }), ); } else { this.writer = muhammara.createWriterToModify( @@ -230,7 +230,7 @@ class Recipe { Object.assign({}, this.encryptOptions, { modifiedFilePath: this.output, log: this.logFile, - }) + }), ); } @@ -242,7 +242,7 @@ class Recipe { if (this.isBufferSrc) { // eslint-disable-next-line no-console console.log( - "Feature: Inserting Pages is not supported in Buffer Mode yet." + "Feature: Inserting Pages is not supported in Buffer Mode yet.", ); } else { this._insertPages(); diff --git a/lib/muhammara.js b/lib/muhammara.js index b47db48a..906b43ab 100644 --- a/lib/muhammara.js +++ b/lib/muhammara.js @@ -1,7 +1,7 @@ var path = require("path"); var pregyp = require("@mapbox/node-pre-gyp"); var binding_path = pregyp.find( - path.resolve(path.join(__dirname, "../package.json")) + path.resolve(path.join(__dirname, "../package.json")), ); var muhammara = (module.exports = require(binding_path)); var EventEmitter = require("events").EventEmitter; @@ -17,7 +17,7 @@ muhammara.PDFWriter.prototype.getEvents = function () { muhammara.PDFWriter.prototype.triggerDocumentExtensionEvent = function ( eventName, - eventParams + eventParams, ) { eventParams.writer = this; this.getEvents().emit(eventName, eventParams); diff --git a/lib/recipe/annotation.js b/lib/recipe/annotation.js index 3a4e267d..b9f46f1f 100644 --- a/lib/recipe/annotation.js +++ b/lib/recipe/annotation.js @@ -48,7 +48,7 @@ exports.annot = function annot( x, y, subtype, - options = { text: "", width: 0, height: 0 } + options = { text: "", width: 0, height: 0 }, ) { const { text, width, height, replies } = options; this.annotationsToWrite.push({ @@ -102,7 +102,7 @@ exports._annot = function _annot(subtype, args = {}, pageNumber, ref) { open: false, flag: "", // 'readonly' }, - options + options, ); const ex = nWidth ? nWidth : 0; @@ -133,7 +133,7 @@ exports._annot = function _annot(subtype, args = {}, pageNumber, ref) { .writeLiteralStringValue(params.title || "") .writeKey("M") .writeLiteralStringValue( - this.writer.createPDFDate(new Date(params.date)).toString() + this.writer.createPDFDate(new Date(params.date)).toString(), ) .writeKey("Open") .writeBooleanValue(params.open) diff --git a/lib/recipe/colors.js b/lib/recipe/colors.js index 93cf6a8c..ba0a57fa 100644 --- a/lib/recipe/colors.js +++ b/lib/recipe/colors.js @@ -81,7 +81,7 @@ exports.chroma = function chroma(name, value, colorspace = "") { // device colorspaces gray, rgb, and cmyk. if (![2, 6, 8].includes(value.toString().length)) { throw new Error( - "Color value has incorrect size for gray, rgb, or cmyk colorspaces" + "Color value has incorrect size for gray, rgb, or cmyk colorspaces", ); } diff --git a/lib/recipe/coordinate.js b/lib/recipe/coordinate.js index 02bea745..2eda84b4 100644 --- a/lib/recipe/coordinate.js +++ b/lib/recipe/coordinate.js @@ -20,7 +20,7 @@ exports._calibrateCoordinate = function _calibrateCoordinate( y, offsetX = 0, offsetY = 0, - pageNumber + pageNumber, ) { pageNumber = pageNumber || this.pageNumber; const { height, mediaBox } = this.metadata[pageNumber]; @@ -41,14 +41,14 @@ exports._calibrateCoordinateForAnnots = function _calibrateCoordinateForAnnots( y, offsetX = 0, offsetY = 0, - pageNumber + pageNumber, ) { const { nx: tx, ny: ty } = this._calibrateCoordinate( x, y, offsetX, offsetY, - pageNumber + pageNumber, ); const { width, height, rotate, mediaBox } = this.metadata[pageNumber]; const startX = mediaBox[0]; @@ -78,7 +78,7 @@ exports._calibrateCoordinateForAnnots = function _calibrateCoordinateForAnnots( ty, 360 - rotate, rotateOffsetX, - rotateOffsetY + rotateOffsetY, ); return { nx, @@ -91,7 +91,7 @@ exports._reverseCoordinate = function _reverseCoordinate( y, offsetX = 0, offsetY = 0, - pageNumber + pageNumber, ) { pageNumber = pageNumber || this.pageNumber; const { height } = this.metadata[pageNumber]; diff --git a/lib/recipe/encrypt.js b/lib/recipe/encrypt.js index f105d512..cb2f2efc 100644 --- a/lib/recipe/encrypt.js +++ b/lib/recipe/encrypt.js @@ -44,7 +44,7 @@ exports.permission = function permission(flags = "print") { exports._getEncryptOptions = function _getEncryptOptions( options, - addPermissions = true + addPermissions = true, ) { const encryptOptions = {}; diff --git a/lib/recipe/font.js b/lib/recipe/font.js index 8c35b039..342916de 100644 --- a/lib/recipe/font.js +++ b/lib/recipe/font.js @@ -12,7 +12,7 @@ const path = require("path"); exports.registerFont = function registerFont( fontName = "", fontSrcPath = "", - type = "regular" + type = "regular", ) { return this._registerFont(fontName, fontSrcPath, type); }; @@ -55,7 +55,7 @@ exports._loadFonts = function _loadFonts(fontSrcPath) { exports._registerFont = function _registerFont( fontName, fontSrcPath, - type = "regular" + type = "regular", ) { this.fonts = this.fonts || {}; let family = fontName.toLowerCase(); @@ -91,10 +91,10 @@ function _getFontFile(self, options = {}) { (options.bold || options.isBold) && (options.italic || options.isItalic) ? "bi" : options.italic || options.isItalic - ? "i" - : options.bold || options.isBold - ? "b" - : "r"; + ? "i" + : options.bold || options.isBold + ? "b" + : "r"; if (options.font) { const fontFamily = self.fonts[options.font.toLowerCase()]; diff --git a/lib/recipe/htmlToTextObjects.js b/lib/recipe/htmlToTextObjects.js index c0459476..b01237c0 100644 --- a/lib/recipe/htmlToTextObjects.js +++ b/lib/recipe/htmlToTextObjects.js @@ -4,7 +4,7 @@ exports.htmlToTextObjects = function (htmlCodes) { htmlCodes = htmlCodes.replace(//g, "

[@@DONOT_RENDER_THIS@@]

"); const nodes = new DOMParser().parseFromString( `${htmlCodes}`, - "text/html" + "text/html", ); const textObjects = parseNode(nodes).childs[0].childs; return textObjects; diff --git a/lib/recipe/image.js b/lib/recipe/image.js index 2047ea95..18c93f81 100644 --- a/lib/recipe/image.js +++ b/lib/recipe/image.js @@ -17,7 +17,7 @@ exports.image = function image(imgSrc, x, y, options = {}) { const { width, height, offsetX, offsetY } = this._getImgOffset( imgSrc, - options + options, ); const imgOptions = { transformation: { diff --git a/lib/recipe/info.js b/lib/recipe/info.js index 25eb02f1..6d30e8dd 100644 --- a/lib/recipe/info.js +++ b/lib/recipe/info.js @@ -36,7 +36,7 @@ exports._readInfo = function _readInfo() { .getSourceDocumentParser() .queryDictionaryObject( copyCtx.getSourceDocumentParser().getTrailer(), - "Info" + "Info", ); const oldInfo = @@ -138,19 +138,19 @@ exports._writeInfo = function _writeInfo() { case "modDate": infoDictionary.addAdditionalInfoEntry( "source-ModDate", - oldInfo.modDate + oldInfo.modDate, ); break; case "creator": infoDictionary.addAdditionalInfoEntry( "source-Creator", - oldInfo.creator + oldInfo.creator, ); break; case "producer": infoDictionary.addAdditionalInfoEntry( "source-Producer", - oldInfo.producer + oldInfo.producer, ); break; default: @@ -301,7 +301,7 @@ exports.structure = function structure(output) { const itemTrailer = pdfReader.queryDictionaryObject( pdfReader.getTrailer(), - item + item, ); logToFile(item); iterateObjectTypes(itemTrailer); diff --git a/lib/recipe/insertPage.js b/lib/recipe/insertPage.js index 444661b1..e9fb7222 100644 --- a/lib/recipe/insertPage.js +++ b/lib/recipe/insertPage.js @@ -13,7 +13,7 @@ const hummusUtils = require("./utils"); exports.insertPage = function insertPage( afterPageNumber, pdfSrc, - srcPageNumber + srcPageNumber, ) { if (isNaN(afterPageNumber)) { throw new Error("The afterPageNumber is inValid."); @@ -68,7 +68,7 @@ exports._insertPages = function _insertPages() { hummusUtils.appendPDFPagesFromPDFWithAnnotations( pdfWriter, info.pdfSrc, - { specificRanges } + { specificRanges }, ); }); } diff --git a/lib/recipe/page.js b/lib/recipe/page.js index ca3462b8..c0b2bb6f 100644 --- a/lib/recipe/page.js +++ b/lib/recipe/page.js @@ -111,7 +111,7 @@ exports.editPage = function editPage(pageNumber) { const pageModifier = new muhammara.PDFPageModifier( pdfWriter, pageIndex, - true + true, ); this.page = pageModifier; this.pageNumber = pageNumber; @@ -135,31 +135,31 @@ exports.editPage = function editPage(pageNumber) { `[${startX}, ${startY}] is HERE`, startX, startY, - textOptions + textOptions, ); context.writeText( `[${startX}, width/2] is HERE`, startX, width / 2, - textOptions + textOptions, ); context.writeText( `[${startX}, height/2] is HERE`, startX, height / 2, - textOptions + textOptions, ); context.writeText( `[width/2, ${startY}] is HERE`, width / 2, startY, - textOptions + textOptions, ); context.writeText( `[height/2, ${startY}] is HERE`, height / 2, startY, - textOptions + textOptions, ); } return this; @@ -167,7 +167,7 @@ exports.editPage = function editPage(pageNumber) { exports._resumePageRotation = function _resumePageRotation( pageNumber, - context + context, ) { pageNumber = pageNumber || this.pageNumber; const { diff --git a/lib/recipe/shapes.js b/lib/recipe/shapes.js index a84e9341..6268646f 100644 --- a/lib/recipe/shapes.js +++ b/lib/recipe/shapes.js @@ -88,8 +88,8 @@ function _n_gon(sides, cx, cy, radius, options = {}) { lineWidth = options.lineWidth ? options.lineWidth : options.width - ? options.width - : 2; + ? options.width + : 2; } let ngon = []; @@ -372,7 +372,7 @@ exports.triangle = function triangle(x, y, traits, options = {}) { if (traits.length !== 3) { throw new Error( - "Triangle requires 3 traits (sides/angles) for definition." + "Triangle requires 3 traits (sides/angles) for definition.", ); } @@ -456,21 +456,21 @@ exports.triangle = function triangle(x, y, traits, options = {}) { [ma_A.point(1).x, ma_A.point(1).y], [ma_A.point(2).x, ma_A.point(2).y], ], - { color: "green", width: 0.5 } + { color: "green", width: 0.5 }, ); this.line( [ [mb_B.point(1).x, mb_B.point(1).y], [mb_B.point(2).x, mb_B.point(2).y], ], - { color: "green", width: 0.5 } + { color: "green", width: 0.5 }, ); this.line( [ [mc_C.point(1).x, mc_C.point(1).y], [mc_C.point(2).x, mc_C.point(2).y], ], - { color: "green", width: 0.5 } + { color: "green", width: 0.5 }, ); } @@ -478,7 +478,7 @@ exports.triangle = function triangle(x, y, traits, options = {}) { triangle.incenter.point.x, triangle.incenter.point.y, triangle.incenter.radius, - { color: "green", width: 0.5 } + { color: "green", width: 0.5 }, ); let ctr_A = new Line(triangle.incenter.point, triangle.A); let ap = ctr_A.extend(10); @@ -533,7 +533,7 @@ const Triangle = class Triangle { }); if (sss[0] + sss[1] <= sss[2]) { throw new Error( - "Not a valid triangle inequality (sum of 2 shortest sides must be greater than third side" + "Not a valid triangle inequality (sum of 2 shortest sides must be greater than third side", ); } @@ -550,7 +550,7 @@ const Triangle = class Triangle { angC = 180 - angA - angB; if (angC <= 0) { throw new Error( - "Not a valid triangle angle specification (sum of 2 angles must less than 180)" + "Not a valid triangle angle specification (sum of 2 angles must less than 180)", ); } a = (c * Math.sin(toRadians(angA))) / Math.sin(toRadians(angC)); @@ -861,7 +861,7 @@ exports.arrow = function arrow(x, y, options = {}) { head.I[0], y - halfShaft, head.E[0], - y - halfShaft + y - halfShaft, ); const ke_shaft_intercept = KE.intersect(shaft_top); arrow.joinShaft(ke_shaft_intercept); @@ -894,7 +894,7 @@ exports.arrow = function arrow(x, y, options = {}) { arrow.tip.K, arrow.tip.I, ], - options + options, ); } else { // Starting at arrow head tip (Pt I below), @@ -921,7 +921,7 @@ exports.arrow = function arrow(x, y, options = {}) { arrow.tip.K, arrow.tip.I, ], - options + options, ); // back to point of arrow to close polygon } @@ -1193,7 +1193,7 @@ const Line = class Line { if (!this._length) { this._length = Math.sqrt( Math.pow(this._pt2.x - this._pt1.x, 2) + - Math.pow(this._pt2.y - this._pt1.y, 2) + Math.pow(this._pt2.y - this._pt1.y, 2), ); } @@ -1243,7 +1243,7 @@ const Line = class Line { deltaX = distance * ss; deltaY = slope * deltaX; newLen = Math.sqrt( - Math.pow(opt.x - (x + deltaX), 2) + Math.pow(opt.y - (y + deltaY), 2) + Math.pow(opt.x - (x + deltaX), 2) + Math.pow(opt.y - (y + deltaY), 2), ); break; } diff --git a/lib/recipe/split.js b/lib/recipe/split.js index 1269d1c7..49eac0de 100644 --- a/lib/recipe/split.js +++ b/lib/recipe/split.js @@ -18,7 +18,7 @@ exports.split = function split(outputDir = "", prefix) { hummusUtils.appendPDFPageFromPDFWithAnnotations( pdfWriter, this.pdfReader, - i + i, ); pdfWriter.end(); } diff --git a/lib/recipe/table.js b/lib/recipe/table.js index 570820e2..80ee719e 100644 --- a/lib/recipe/table.js +++ b/lib/recipe/table.js @@ -20,12 +20,12 @@ function getCellHeight(self, text, column, options) { column.y, 0, 0, - self.pageNumber + self.pageNumber, ); const pathOptions = self._getPathOptions( colOptions, originCoord.nx, - originCoord.ny + originCoord.ny, ); const textObjects = self._makeTextObject(text, pathOptions.size, colOptions); const textBox = self._makeTextBox(colOptions); @@ -53,7 +53,7 @@ function drawTableBorder(self, x, y, width, height, rowLines, options) { [column.x + column.width, y], [column.x + column.width, y + height], ], - borderOptions + borderOptions, ); } // Draw horizontals @@ -64,7 +64,7 @@ function drawTableBorder(self, x, y, width, height, rowLines, options) { [x, yPos], [x + width, yPos], ], - borderOptions + borderOptions, ); } } @@ -290,7 +290,7 @@ exports.table = function table(x, y, contents, options = {}) { const cellOptions = getCellOptions(column.options, "hcell"); colOptions.textBox = this._merge( colOptions.textBox, - clone(cellOptions.textBox) + clone(cellOptions.textBox), ); } diff --git a/lib/recipe/text.helper.js b/lib/recipe/text.helper.js index 33bd70ee..5e4d4b3e 100644 --- a/lib/recipe/text.helper.js +++ b/lib/recipe/text.helper.js @@ -24,7 +24,7 @@ const Word = class Word { } this._dimensions = this._pathOptions.font.calculateTextDimensions( this._text, - this._pathOptions.size + this._pathOptions.size, ); this._dimensions.xMax += this.charSpacing; return this._dimensions; @@ -46,7 +46,7 @@ const Word = class Word { this._text = this._value; this._dimensions = this._pathOptions.font.calculateTextDimensions( this._text, - this._pathOptions.size + this._pathOptions.size, ); this._dimensions.xMax += this.charSpacing; } @@ -157,7 +157,7 @@ exports.Line = class Line { } const toHeight = this._pathOptions.font.calculateTextDimensions( this.value, - this.size + this.size, ).height; // ymax return toHeight + 20; } diff --git a/lib/recipe/text.js b/lib/recipe/text.js index 1833782c..16c20237 100644 --- a/lib/recipe/text.js +++ b/lib/recipe/text.js @@ -120,7 +120,7 @@ function _initOptions(self, x = {}, y, options = {}) { if (self._flow && mergedOpts.textBox.width === undefined) { mergedOpts.textBox.width = Math.max( 0, - self.metadata[self.pageNumber].width - self.x - self._margin.right + self.metadata[self.pageNumber].width - self.x - self._margin.right, ); } @@ -260,12 +260,12 @@ exports.text = function text(text = "", x, y, options = {}) { this.y, 0, 0, - this.pageNumber + this.pageNumber, ); const pathOptions = this._getPathOptions( options, originCoord.nx, - originCoord.ny + originCoord.ny, ); pathOptions.html = options.html; pathOptions.hilite = options.hilite; @@ -281,7 +281,7 @@ exports.text = function text(text = "", x, y, options = {}) { let { toWriteTextObjects } = this._layoutText( textObjects, textBox, - pathOptions + pathOptions, ); if (!textBox.width) { @@ -494,7 +494,7 @@ exports.text = function text(text = "", x, y, options = {}) { options, (word, xx) => { emitText(word.value, xx, y + baseline, context); - } + }, ); } else { if (textBox.wrap !== "auto") { @@ -520,7 +520,7 @@ exports.text = function text(text = "", x, y, options = {}) { const xObject = new xObjectForm( this.writer, textBox.width, - lineHeight + lineHeight, ); const xObjectCtx = xObject.getContentContext(); if (options.colorModel) { @@ -540,7 +540,7 @@ exports.text = function text(text = "", x, y, options = {}) { options, (word, xx) => { emitText(word.value, xx - nx, baseline, xObjectCtx, options); - } + }, ); } else { emitTextObject(text, x - nx, baseline, xObjectCtx, options); @@ -747,8 +747,8 @@ exports._layoutText = function _layoutText(textObjects, textBox, pathOptions) { textBox.padding[3] !== undefined ? textBox.padding[3] : textBox.padding[1] !== undefined - ? textBox.padding[1] - : textBox.padding[0], + ? textBox.padding[1] + : textBox.padding[0], }); let firstLineHeight; @@ -874,7 +874,7 @@ function getTextBoxPosition(self, textBox, pathOptions) { self.x, self.y, offsetX, - offsetY + offsetY, ); return [nx, ny]; } @@ -896,7 +896,7 @@ function drawTextBox(self, nx, ny, textBox, pathOptions) { rotation: pathOptions.rotation, rotationOrigin: [pathOptions.originX, pathOptions.originY], borderRadius: borderRadius, - }) + }), ); } @@ -996,7 +996,7 @@ function elideNonFittingText(textBox, line, word, pathOptions) { } else if (!usingPreviousWord) { tooBig = new Word( line.words.pop().value.slice(0, -1) + ellipsis, - pathOptions + pathOptions, ); usingPreviousWord = true; } else { @@ -1094,7 +1094,7 @@ function makeTextObjects(self, textObject = {}, pathOptions, textBox = {}) { // Need special characters '|}' because they have ascenders that go beyond upper case letters. const textDimensions = pathOptions.font.calculateTextDimensions( "ABCDEFGHIJKLMNOPQRSTUVWXYZgjpqy|}", - size + size, ); const textHeight = textDimensions.height; @@ -1217,7 +1217,7 @@ function makeTextObjects(self, textObject = {}, pathOptions, textBox = {}) { newLine, toWriteTextObjects, wordCount, - totalTextWidth + totalTextWidth, ); toWriteTextObjects.push( @@ -1230,8 +1230,8 @@ function makeTextObjects(self, textObject = {}, pathOptions, textBox = {}) { wordCount: wordCount, totalTextWidth: totalTextWidth, lineComplete: true, - }) - ) + }), + ), ); wordCount = 0; totalTextWidth = 0; @@ -1255,8 +1255,8 @@ function makeTextObjects(self, textObject = {}, pathOptions, textBox = {}) { textBox, Object.assign({}, lineOpts, { lineComplete: true, - }) - ) + }), + ), ); } } else { @@ -1297,8 +1297,8 @@ function makeTextObjects(self, textObject = {}, pathOptions, textBox = {}) { newLine, lineID, textBox, - Object.assign({ lineComplete: true, lastLine: true }, lineOpts) - ) + Object.assign({ lineComplete: true, lastLine: true }, lineOpts), + ), ); markLineComplete(toWriteTextObjects); newLine = new Line(lineMaxWidth, lineHeight, size, pathOptions); @@ -1319,7 +1319,7 @@ function makeTextObjects(self, textObject = {}, pathOptions, textBox = {}) { newLine, toWriteTextObjects, wordCount, - totalTextWidth + totalTextWidth, ); toWriteTextObjects.push( @@ -1332,8 +1332,8 @@ function makeTextObjects(self, textObject = {}, pathOptions, textBox = {}) { wordCount: wordCount, totalTextWidth: totalTextWidth, lastLine: isLastLine, - }) - ) + }), + ), ); } else { toWriteTextObjects[toWriteTextObjects.length - 1].lastLine = isLastLine; @@ -1378,9 +1378,8 @@ exports.movedown = function movedown(lines = 1, returnCoords = false) { } else { // This handles continuous text positioning markLineComplete(this._previousTextObjects, lines); - this._previousTextObjects[ - this._previousTextObjects.length - 1 - ].lastLine = true; + this._previousTextObjects[this._previousTextObjects.length - 1].lastLine = + true; } return returnCoords ? [this.x, this.y] : this; @@ -1458,7 +1457,7 @@ exports.layout = function layout(id, x, y, width, height, options = {}) { height, element.text, element.name, - element + element, ); this._layouts[id].push(column); x += width; diff --git a/lib/recipe/utils.js b/lib/recipe/utils.js index bdaa1b6c..0718e99e 100644 --- a/lib/recipe/utils.js +++ b/lib/recipe/utils.js @@ -11,7 +11,7 @@ const ANNOTATION_PREFIX = "Annots"; function appendPDFPageFromPDFWithAnnotations( pdfWriter, sourcePDFPath, - pageNumber + pageNumber, ) { const cpyCxt = pdfWriter.createPDFCopyingContext(sourcePDFPath); const cpyCxtParser = cpyCxt.getSourceDocumentParser(); @@ -24,7 +24,7 @@ function appendPDFPageFromPDFWithAnnotations( pdfWriter.getEvents().once("OnPageWrite", (params) => { params.pageDictionaryContext.writeKey(ANNOTATION_PREFIX); reffedObjects = cpyCxt.copyDirectObjectWithDeepCopy( - pageDictionary.queryObject(ANNOTATION_PREFIX) + pageDictionary.queryObject(ANNOTATION_PREFIX), ); }); @@ -46,7 +46,7 @@ function appendPDFPageFromPDFWithAnnotations( function appendPDFPagesFromPDFWithAnnotations( pdfWriter, sourcePDFPath, - options = {} + options = {}, ) { const cpyCxt = pdfWriter.createPDFCopyingContext(sourcePDFPath); const cpyCxtParser = cpyCxt.getSourceDocumentParser(); diff --git a/lib/recipe/vector-polygon.js b/lib/recipe/vector-polygon.js index 0ff0c756..e1246294 100644 --- a/lib/recipe/vector-polygon.js +++ b/lib/recipe/vector-polygon.js @@ -105,7 +105,7 @@ exports.polygon = function polygon(coordinates = [], options = {}) { xObject.fill(colorModel); drawPolygon(ctx, coordinates); ctx.f(); - } + }, ); } @@ -127,7 +127,7 @@ exports.polygon = function polygon(coordinates = [], options = {}) { xObject.stroke(colorModel); drawPolygon(ctx, coordinates); ctx.s(); - } + }, ); } diff --git a/lib/recipe/vector.helper.js b/lib/recipe/vector.helper.js index 321a0520..8b1d9bb5 100644 --- a/lib/recipe/vector.helper.js +++ b/lib/recipe/vector.helper.js @@ -3,7 +3,7 @@ const { xObjectForm } = require("./xObjectForm"); exports._getPathOptions = function _getPathOptions( options = {}, originX, - originY + originY, ) { this.current = this.current || {}; const colorspace = options.colorspace || this.options.colorspace; @@ -73,7 +73,7 @@ exports._getPathOptions = function _getPathOptions( pathOptions.colorModel = this._transformColor( options.color || options.colour, - colorOpts + colorOpts, ); pathOptions.color = pathOptions.colorModel.color; pathOptions.colorspace = pathOptions.colorModel.colorspace; @@ -142,7 +142,7 @@ exports._setRotationContext = function _setRotationTransform( context, x, y, - options + options, ) { const deltaY = options.deltaY ? options.deltaY : 0; @@ -159,7 +159,7 @@ exports._setRotationContext = function _setRotationTransform( } else { const orig = this._calibrateCoordinate( options.rotationOrigin[0], - options.rotationOrigin[1] + options.rotationOrigin[1], ); rotationOrigin = [orig.nx, orig.ny]; } @@ -171,7 +171,7 @@ exports._setRotationContext = function _setRotationTransform( rotationOrigin[0], rotationOrigin[1], x - rotationOrigin[0], - y - rotationOrigin[1] - deltaY + y - rotationOrigin[1] - deltaY, ); context.cm(rm[0], rm[1], rm[2], rm[3], rm[4], rm[5]); @@ -220,7 +220,7 @@ exports._drawObject = function _drawObject( width, height, options, - callback + callback, ) { let xObject = options.xObject; // allows caller to supply existing form object diff --git a/lib/recipe/vector.js b/lib/recipe/vector.js index b25a0ad6..8b033069 100644 --- a/lib/recipe/vector.js +++ b/lib/recipe/vector.js @@ -52,7 +52,7 @@ exports.circle = function circle(x, y, radius, options = {}) { ctx .gs(xObject.getGsName(pathOptions.fillGsId)) .drawCircle(radius, radius, radius, pathOptions); - } + }, ); } if (options.stroke || options.color || !options.fill) { @@ -80,11 +80,11 @@ exports.circle = function circle(x, y, radius, options = {}) { radius, radius, radius - pathOptions.width / 2, - pathOptions + pathOptions, ); // ... requires adjusting the internal drawing to accomodate line thickness. - } + }, ); } return this; @@ -148,7 +148,7 @@ exports.rectangle = function rectangle(x, y, width, height, options = {}) { } else { ctx.drawRectangle(0, 0, width, height, pathOptions); } - } + }, ); } @@ -184,7 +184,7 @@ exports.rectangle = function rectangle(x, y, width, height, options = {}) { margin / 2, width - margin, height - margin, - options.borderRadius + options.borderRadius, ); ctx.S(); } else { @@ -195,10 +195,10 @@ exports.rectangle = function rectangle(x, y, width, height, options = {}) { margin / 2, width - margin, height - margin, - pathOptions + pathOptions, ); } - } + }, ); } @@ -242,7 +242,7 @@ function drawRoundedRectangle(ctx, left, bottom, width, height, radii) { left + radius[0] * (1 - K), top, left + radius[0], - top + top, ) .l(right - radius[1], top) // top-right @@ -252,7 +252,7 @@ function drawRoundedRectangle(ctx, left, bottom, width, height, radii) { right, top - radius[1] * (1 - K), right, - top - radius[1] + top - radius[1], ) .l(right, bottom + radius[2]) // bottom-right @@ -262,7 +262,7 @@ function drawRoundedRectangle(ctx, left, bottom, width, height, radii) { right - radius[2] * (1 - K), bottom, right - radius[2], - bottom + bottom, ) .l(left + radius[3], bottom) // bottom-left @@ -272,7 +272,7 @@ function drawRoundedRectangle(ctx, left, bottom, width, height, radii) { left, bottom + radius[3] * (1 - K), left, - bottom + radius[3] + bottom + radius[3], ) .l(left, top - radius[0]); // back to top-left @@ -340,7 +340,7 @@ exports.ellipse = function ellipse(cx, cy, rx, ry, options = {}) { xObject.fill(colorModel); drawEllipse(ctx, 0, 0, width, height); ctx.f(); - } + }, ); } @@ -369,10 +369,10 @@ exports.ellipse = function ellipse(cx, cy, rx, ry, options = {}) { margin, margin, width - pathOptions.width, - height - pathOptions.width + height - pathOptions.width, ); ctx.S(); - } + }, ); } return this; @@ -464,7 +464,7 @@ exports.arc = function arc( radius, startAngle = 0, endAngle = 360, - options = {} + options = {}, ) { const { nx, ny } = this._calibrateCoordinate(x, y); const diameter = radius * 2; @@ -495,7 +495,7 @@ exports.arc = function arc( drawArc(ctx, radius, radius, radius, sAng, eAng, sector); ctx.f(); - } + }, ); } @@ -524,7 +524,7 @@ exports.arc = function arc( ctx.h(); } // close off path to create a circle sector. ctx.S(); - } + }, ); } diff --git a/tests/AppendPagesTest.js b/tests/AppendPagesTest.js index 1f23af74..5f55e19e 100644 --- a/tests/AppendPagesTest.js +++ b/tests/AppendPagesTest.js @@ -4,14 +4,14 @@ const expect = require("chai").expect; describe("AppendPagesTest", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/AppendPagesTest.pdf" + __dirname + "/output/AppendPagesTest.pdf", ); pdfWriter.appendPDFPagesFromPDF(__dirname + "/TestMaterials/Original.pdf"); pdfWriter.appendPDFPagesFromPDF( - __dirname + "/TestMaterials/XObjectContent.PDF" + __dirname + "/TestMaterials/XObjectContent.PDF", ); pdfWriter.appendPDFPagesFromPDF( - __dirname + "/TestMaterials/BasicTIFFImagesTest.PDF" + __dirname + "/TestMaterials/BasicTIFFImagesTest.PDF", ); pdfWriter.end(); @@ -22,8 +22,8 @@ describe("AppendPagesTest", function () { var pdfWriter = muhammara.createWriter(writerBuffer); expect(() => pdfWriter.appendPDFPagesFromPDF( - __dirname + "/TestMaterials/appendbreaks.pdf" - ) + __dirname + "/TestMaterials/appendbreaks.pdf", + ), ).to.throw("unable to append"); }); }); diff --git a/tests/AppendSpecialPagesTest.js b/tests/AppendSpecialPagesTest.js index 0e96d0f8..8148bdf1 100644 --- a/tests/AppendSpecialPagesTest.js +++ b/tests/AppendSpecialPagesTest.js @@ -3,28 +3,28 @@ var assert = require("assert"); describe("AppendSpecialPagesTest", function () { it("should complete without error", function () { var pdfWriter = require("../lib/muhammara").createWriter( - __dirname + "/output/AppendSpecialPagesTest.pdf" + __dirname + "/output/AppendSpecialPagesTest.pdf", ); assert.throws(function () { pdfWriter.appendPDFPagesFromPDF("./TestMaterials/Protected.pdf"); }); pdfWriter.appendPDFPagesFromPDF( - __dirname + "/TestMaterials/ObjectStreamsModified.pdf" + __dirname + "/TestMaterials/ObjectStreamsModified.pdf", ); pdfWriter.appendPDFPagesFromPDF( - __dirname + "/TestMaterials/ObjectStreams.pdf" + __dirname + "/TestMaterials/ObjectStreams.pdf", ); pdfWriter.appendPDFPagesFromPDF(__dirname + "/TestMaterials/AddedItem.pdf"); pdfWriter.appendPDFPagesFromPDF(__dirname + "/TestMaterials/AddedPage.pdf"); pdfWriter.appendPDFPagesFromPDF( - __dirname + "/TestMaterials/MultipleChange.pdf" + __dirname + "/TestMaterials/MultipleChange.pdf", ); pdfWriter.appendPDFPagesFromPDF( - __dirname + "/TestMaterials/RemovedItem.pdf" + __dirname + "/TestMaterials/RemovedItem.pdf", ); pdfWriter.appendPDFPagesFromPDF( - __dirname + "/TestMaterials/Linearized.pdf" + __dirname + "/TestMaterials/Linearized.pdf", ); pdfWriter.end(); }); diff --git a/tests/BasicJPGImagesTest.js b/tests/BasicJPGImagesTest.js index 08422da2..eec61519 100644 --- a/tests/BasicJPGImagesTest.js +++ b/tests/BasicJPGImagesTest.js @@ -1,7 +1,7 @@ describe("BasicJPGImagesTest", function () { it("should complete without error", function () { var pdfWriter = require("../lib/muhammara").createWriter( - __dirname + "/output/BasicJPGImagesTest.PDF" + __dirname + "/output/BasicJPGImagesTest.PDF", ); var page = pdfWriter.createPage(0, 0, 595, 842); @@ -16,7 +16,7 @@ describe("BasicJPGImagesTest", function () { pdfWriter.pausePageContentContext(contentContext); var imageXObject = pdfWriter.createImageXObjectFromJPG( - __dirname + "/TestMaterials/images/otherStage.JPG" + __dirname + "/TestMaterials/images/otherStage.JPG", ); // now continue with page content placement @@ -26,7 +26,7 @@ describe("BasicJPGImagesTest", function () { pdfWriter.pausePageContentContext(contentContext); var formXObject = pdfWriter.createFormXObjectFromJPG( - __dirname + "/TestMaterials/images/otherStage.JPG" + __dirname + "/TestMaterials/images/otherStage.JPG", ); contentContext.q().cm(1, 0, 0, 1, 0, 400).doXObject(formXObject).Q(); diff --git a/tests/BasicModification.js b/tests/BasicModification.js index c2ab891e..afb536c4 100644 --- a/tests/BasicModification.js +++ b/tests/BasicModification.js @@ -5,15 +5,15 @@ function testInPlaceFileModification(inFileName) { describe(inFileName, function () { it("should complete without error", function () { var ws = fs.createWriteStream( - __dirname + "/output/InPlaceModified" + inFileName + ".pdf" + __dirname + "/output/InPlaceModified" + inFileName + ".pdf", ); var rs = fs.createReadStream( - __dirname + "/TestMaterials/" + inFileName + ".pdf" + __dirname + "/TestMaterials/" + inFileName + ".pdf", ); ws.on("close", function () { var pdfWriter = muhammara.createWriterToModify( - __dirname + "/output/InPlaceModified" + inFileName + ".pdf" + __dirname + "/output/InPlaceModified" + inFileName + ".pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); @@ -24,9 +24,9 @@ function testInPlaceFileModification(inFileName) { .Tf( pdfWriter.getFontForFile( __dirname + "/TestMaterials/fonts/Courier.dfont", - 0 + 0, ), - 1 + 1, ) .Tm(30, 0, 0, 30, 78.4252, 662.8997) .Tj("about") diff --git a/tests/BasicModification2.js b/tests/BasicModification2.js index c18ef7c9..8eef7e38 100644 --- a/tests/BasicModification2.js +++ b/tests/BasicModification2.js @@ -16,7 +16,7 @@ function testBasicFileModification(inFileName, throws) { { modifiedFilePath: __dirname + "/output/Modified" + inFileName + ".pdf", - } + }, ); var page = pdfWriter.createPage(0, 0, 595, 842); @@ -27,9 +27,9 @@ function testBasicFileModification(inFileName, throws) { .Tf( pdfWriter.getFontForFile( __dirname + "/TestMaterials/fonts/Courier.dfont", - 0 + 0, ), - 1 + 1, ) .Tm(30, 0, 0, 30, 78.4252, 662.8997) .Tj("about") diff --git a/tests/BasicModificationWithStreams.js b/tests/BasicModificationWithStreams.js index d2d64dbd..b8449485 100644 --- a/tests/BasicModificationWithStreams.js +++ b/tests/BasicModificationWithStreams.js @@ -4,10 +4,10 @@ const chai = require("chai"); describe("BasicModificationWithStreams", function () { it("should complete without error", function () { var inStream = new muhammara.PDFRStreamForFile( - __dirname + "/TestMaterials/MultipleChange.pdf" + __dirname + "/TestMaterials/MultipleChange.pdf", ); var outStream = new muhammara.PDFWStreamForFile( - __dirname + "/output/BasicModificationWithStreams.pdf" + __dirname + "/output/BasicModificationWithStreams.pdf", ); var pdfWriter = muhammara.createWriterToModify(inStream, outStream); var pageModifier = new muhammara.PDFPageModifier(pdfWriter, 0); @@ -17,7 +17,7 @@ describe("BasicModificationWithStreams", function () { .getContext() .writeText("Some added Text", 75, 805, { font: pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/Couri.ttf" + __dirname + "/TestMaterials/fonts/Couri.ttf", ), size: 14, colorspace: "gray", diff --git a/tests/BasicPNGImagesTest.js b/tests/BasicPNGImagesTest.js index a499e4ee..b5105827 100644 --- a/tests/BasicPNGImagesTest.js +++ b/tests/BasicPNGImagesTest.js @@ -2,7 +2,7 @@ describe("BasicPNGImagesTest", function () { it("should complete without error", function () { var pdfWriter = require("../lib/muhammara").createWriter( __dirname + "/output/BasicPNGImagesTest.pdf", - { log: __dirname + "/output/BasicPNGImagesTest.log" } + { log: __dirname + "/output/BasicPNGImagesTest.log" }, ); var pathFillOptions = { color: 0xff0000, colorspace: "rgb", type: "fill" }; @@ -16,7 +16,7 @@ describe("BasicPNGImagesTest", function () { 10, 200, __dirname + "/TestMaterials/images/png/original.png", - imageOptions + imageOptions, ); pdfWriter.writePage(page); @@ -28,7 +28,7 @@ describe("BasicPNGImagesTest", function () { 10, 200, __dirname + "/TestMaterials/images/png/original_transparent.png", - imageOptions + imageOptions, ); pdfWriter.writePage(page); @@ -40,7 +40,7 @@ describe("BasicPNGImagesTest", function () { 10, 200, __dirname + "/TestMaterials/images/png/pnglogo-grr.png", - imageOptions + imageOptions, ); pdfWriter.writePage(page); @@ -52,7 +52,7 @@ describe("BasicPNGImagesTest", function () { 10, 200, __dirname + "/TestMaterials/images/png/gray-alpha-8-linear.png", - imageOptions + imageOptions, ); pdfWriter.writePage(page); @@ -64,7 +64,7 @@ describe("BasicPNGImagesTest", function () { 10, 200, __dirname + "/TestMaterials/images/png/gray-16-linear.png", - imageOptions + imageOptions, ); pdfWriter.writePage(page); diff --git a/tests/BufferReadTest.js b/tests/BufferReadTest.js index ee1bc9e3..0598d195 100644 --- a/tests/BufferReadTest.js +++ b/tests/BufferReadTest.js @@ -9,17 +9,17 @@ describe("BufferRead", function () { var stream = new muhammara.PDFRStreamForBuffer(buffer); assert.equal( stream.read(originalString.length * 10).length, - originalString.length + originalString.length, ); }); it("should be able to use buffer reader correctly to modify files", function () { var data = fs.readFileSync( - __dirname + "/TestMaterials/BasicJPGImagesTest.PDF" + __dirname + "/TestMaterials/BasicJPGImagesTest.PDF", ); var source = new muhammara.PDFRStreamForBuffer(data); var target = new muhammara.PDFWStreamForFile( - __dirname + "/output/ModifiedFromBufferSource.pdf" + __dirname + "/output/ModifiedFromBufferSource.pdf", ); var pdfWriter = muhammara.createWriterToModify(source, target); @@ -29,7 +29,7 @@ describe("BufferRead", function () { .getContext() .writeText("Test Text", 75, 805, { font: pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/Couri.ttf" + __dirname + "/TestMaterials/fonts/Couri.ttf", ), size: 14, colorspace: "gray", diff --git a/tests/CopyingAndMergingEmptyPages.js b/tests/CopyingAndMergingEmptyPages.js index 4c6829ca..6c92f3d8 100644 --- a/tests/CopyingAndMergingEmptyPages.js +++ b/tests/CopyingAndMergingEmptyPages.js @@ -10,11 +10,11 @@ describe("CopyingAndMergingEmptyPage", function () { it("should be able to create from from empty page", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/CreateFormFromEmptyPage.pdf" + __dirname + "/output/CreateFormFromEmptyPage.pdf", ); var formIDs = pdfWriter.createFormXObjectsFromPDF( emptyFileName, - muhammara.ePDFPageBoxMediaBox + muhammara.ePDFPageBoxMediaBox, ); var page = pdfWriter.createPage(0, 0, 595, 842); @@ -23,7 +23,7 @@ describe("CopyingAndMergingEmptyPage", function () { .q() .cm(0.5, 0, 0, 0.5, 0, 421) .doXObject( - page.getResourcesDictionary().addFormXObjectMapping(formIDs[0]) + page.getResourcesDictionary().addFormXObjectMapping(formIDs[0]), ) .Q() .G(0) @@ -36,22 +36,22 @@ describe("CopyingAndMergingEmptyPage", function () { it("should be able to create page from empty page", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/CreatePageFromEmptyPage.pdf" + __dirname + "/output/CreatePageFromEmptyPage.pdf", ); pdfWriter.appendPDFPagesFromPDF(emptyFileName); pdfWriter.appendPDFPagesFromPDF( - __dirname + "/TestMaterials/XObjectContent.PDF" + __dirname + "/TestMaterials/XObjectContent.PDF", ); pdfWriter.end(); }); it("should be able to merge empty page to page", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/MergeEmptyPageToPage.pdf" + __dirname + "/output/MergeEmptyPageToPage.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var font = pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/arial.ttf" + __dirname + "/TestMaterials/fonts/arial.ttf", ); var contentContext = pdfWriter @@ -84,7 +84,7 @@ describe("CopyingAndMergingEmptyPage", function () { it("should be able to merge empty page to form", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/MergeEmptyPageToForm.pdf" + __dirname + "/output/MergeEmptyPageToForm.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var copyingContext = pdfWriter.createPDFCopyingContext(emptyFileName); diff --git a/tests/DFontTest.js b/tests/DFontTest.js index 25daa892..097347c4 100644 --- a/tests/DFontTest.js +++ b/tests/DFontTest.js @@ -1,7 +1,7 @@ describe("DFontTest", function () { it("should complete without error", function () { var pdfWriter = require("../lib/muhammara").createWriter( - __dirname + "/output/DFontTest.pdf" + __dirname + "/output/DFontTest.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var contentContext = pdfWriter.startPageContentContext(page); @@ -9,19 +9,19 @@ describe("DFontTest", function () { [ pdfWriter.getFontForFile( __dirname + "/TestMaterials/fonts/Courier.dfont", - 0 + 0, ), pdfWriter.getFontForFile( __dirname + "/TestMaterials/fonts/Courier.dfont", - 1 + 1, ), pdfWriter.getFontForFile( __dirname + "/TestMaterials/fonts/Courier.dfont", - 2 + 2, ), pdfWriter.getFontForFile( __dirname + "/TestMaterials/fonts/Courier.dfont", - 3 + 3, ), ].forEach(function (element, index, array) { contentContext diff --git a/tests/EmptyPagesPDF.js b/tests/EmptyPagesPDF.js index 0a4e908d..0e70b1fe 100644 --- a/tests/EmptyPagesPDF.js +++ b/tests/EmptyPagesPDF.js @@ -4,7 +4,7 @@ describe("EmptyPagesTest", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( __dirname + "/output/EmptyPages.pdf", - { version: muhammara.ePDFVersion14 } + { version: muhammara.ePDFVersion14 }, ); var page = pdfWriter.createPage(); diff --git a/tests/EmptyWriter.js b/tests/EmptyWriter.js index 9deecf6b..8af99c34 100644 --- a/tests/EmptyWriter.js +++ b/tests/EmptyWriter.js @@ -6,7 +6,7 @@ describe("EmptyWriter", function () { __dirname + "/output/EmptyWriter.pdf", { version: muhammara.ePDFVersion14, - } + }, ); pdfWriter.end(); }); diff --git a/tests/FormXObjectTest.js b/tests/FormXObjectTest.js index ba6db267..c7f964f2 100644 --- a/tests/FormXObjectTest.js +++ b/tests/FormXObjectTest.js @@ -3,7 +3,7 @@ var muhammara = require("../lib/muhammara"); describe("FormXObjectTest", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/XObjectContent.pdf" + __dirname + "/output/XObjectContent.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var pageContent = pdfWriter.startPageContentContext(page); diff --git a/tests/HighLevelContentContext.js b/tests/HighLevelContentContext.js index c772726d..95080e1a 100644 --- a/tests/HighLevelContentContext.js +++ b/tests/HighLevelContentContext.js @@ -1,14 +1,14 @@ describe("HighLevelContentContext", function () { it("should complete without error", function () { var pdfWriter = require("../lib/muhammara").createWriter( - __dirname + "/output/HighLevelContentContext.pdf" + __dirname + "/output/HighLevelContentContext.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var cxt = pdfWriter.startPageContentContext(page); var textOptions = { font: pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/arial.ttf" + __dirname + "/TestMaterials/fonts/arial.ttf", ), size: 14, colorspace: "gray", @@ -31,7 +31,7 @@ describe("HighLevelContentContext", function () { [149, 800], [225, 640], ], - pathFillOptions + pathFillOptions, ) .drawPath( 75, @@ -44,7 +44,7 @@ describe("HighLevelContentContext", function () { 440, 223, 540, - pathStrokeOptions + pathStrokeOptions, ); // drawSquare diff --git a/tests/HighLevelImages.js b/tests/HighLevelImages.js index 9264de5f..7ac4a6a9 100644 --- a/tests/HighLevelImages.js +++ b/tests/HighLevelImages.js @@ -1,7 +1,7 @@ describe("HighLevelImages", function () { it("should complete without error", function () { var pdfWriter = require("../lib/muhammara").createWriter( - __dirname + "/output/HighLevelImages.pdf" + __dirname + "/output/HighLevelImages.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var cxt = pdfWriter.startPageContentContext(page); @@ -11,7 +11,7 @@ describe("HighLevelImages", function () { .drawImage( 10, 10, - __dirname + "/TestMaterials/images/soundcloud_logo.jpg" + __dirname + "/TestMaterials/images/soundcloud_logo.jpg", ) .drawImage(10, 500, __dirname + "/TestMaterials/images/tiff/cramps.tif") .drawImage(0, 0, __dirname + "/TestMaterials/XObjectContent.PDF"); @@ -26,13 +26,13 @@ describe("HighLevelImages", function () { 10, 10, __dirname + "/TestMaterials/images/tiff/multipage.tif", - { index: 2 } + { index: 2 }, ) .drawImage( 10, 10, __dirname + "/TestMaterials/images/soundcloud_logo.jpg", - { transformation: [0.25, 0, 0, 0.25, 0, 0] } + { transformation: [0.25, 0, 0, 0.25, 0, 0] }, ) .drawImage(0, 0, __dirname + "/TestMaterials/XObjectContent.PDF", { transformation: { width: 100, height: 100 }, @@ -47,14 +47,14 @@ describe("HighLevelImages", function () { cxt.drawRectangle(100, 100, 100, 100, pathStrokeOptions); var jpgDimensions = pdfWriter.getImageDimensions( - __dirname + "/TestMaterials/images/soundcloud_logo.jpg" + __dirname + "/TestMaterials/images/soundcloud_logo.jpg", ); cxt.drawRectangle( 10, 10, jpgDimensions.width / 4, jpgDimensions.height / 4, - pathStrokeOptions + pathStrokeOptions, ); pdfWriter.writePage(page); diff --git a/tests/ImageTypeTest.js b/tests/ImageTypeTest.js index b106dde0..63770553 100644 --- a/tests/ImageTypeTest.js +++ b/tests/ImageTypeTest.js @@ -5,33 +5,33 @@ describe("ImageTypeTest", function () { it("should complete without error and read fields correctly", function () { var pdfWriter = muhammara.createWriter( __dirname + "/output/DummyEmptyFile.pdf", - { version: muhammara.ePDFVersion14 } + { version: muhammara.ePDFVersion14 }, ); // just using it for the pdfWriter instance. now check different image types assert.equal( pdfWriter.getImageType( - __dirname + "/TestMaterials/images/otherStage.JPG" + __dirname + "/TestMaterials/images/otherStage.JPG", ), "JPEG", - "jpg image type" + "jpg image type", ); assert.equal( pdfWriter.getImageType( - __dirname + "/TestMaterials/images/tiff/FLAG_T24.TIF" + __dirname + "/TestMaterials/images/tiff/FLAG_T24.TIF", ), "TIFF", - "tiff image type" + "tiff image type", ); assert.equal( pdfWriter.getImageType(__dirname + "/TestMaterials/AddedItem.pdf"), "PDF", - "pdf image type" + "pdf image type", ); assert.equal( pdfWriter.getImageType(__dirname + "/TestMaterials/fonts/arial.ttf"), undefined, - "undefined image type" + "undefined image type", ); pdfWriter.end(); diff --git a/tests/ImagesAndFormsForwardReferenceTest.js b/tests/ImagesAndFormsForwardReferenceTest.js index 3ed6044a..2820a8c5 100644 --- a/tests/ImagesAndFormsForwardReferenceTest.js +++ b/tests/ImagesAndFormsForwardReferenceTest.js @@ -3,7 +3,7 @@ var muhammara = require("../lib/muhammara"); describe("ImagesAndFormsForwardReferenceTest", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/ImagesAndFormsForwardReferenceTest.PDF" + __dirname + "/output/ImagesAndFormsForwardReferenceTest.PDF", ); var page = pdfWriter.createPage(0, 0, 595, 840); var pageContentContext = pdfWriter.startPageContentContext(page); @@ -13,7 +13,7 @@ describe("ImagesAndFormsForwardReferenceTest", function () { // allocate an id for an image, to be used later var imageXObjectID = pdfWriter.getObjectsContext().allocateNewObjectID(); pageContentContext.doXObject( - page.getResourcesDictionary().addImageXObjectMapping(imageXObjectID) + page.getResourcesDictionary().addImageXObjectMapping(imageXObjectID), ); // add required PDF procsets for image @@ -26,7 +26,7 @@ describe("ImagesAndFormsForwardReferenceTest", function () { var formXObjectID = pdfWriter.getObjectsContext().allocateNewObjectID(); pageContentContext .doXObject( - page.getResourcesDictionary().addFormXObjectMapping(formXObjectID) + page.getResourcesDictionary().addFormXObjectMapping(formXObjectID), ) .Q() .q(); @@ -34,7 +34,7 @@ describe("ImagesAndFormsForwardReferenceTest", function () { var tiffFormXObjectID = pdfWriter.getObjectsContext().allocateNewObjectID(); pageContentContext .doXObject( - page.getResourcesDictionary().addFormXObjectMapping(tiffFormXObjectID) + page.getResourcesDictionary().addFormXObjectMapping(tiffFormXObjectID), ) .Q() .q() @@ -44,7 +44,7 @@ describe("ImagesAndFormsForwardReferenceTest", function () { .getObjectsContext() .allocateNewObjectID(); pageContentContext.doXObject( - page.getResourcesDictionary().addFormXObjectMapping(simpleFormXObjectID) + page.getResourcesDictionary().addFormXObjectMapping(simpleFormXObjectID), ); pageContentContext.Q(); @@ -54,15 +54,15 @@ describe("ImagesAndFormsForwardReferenceTest", function () { // now create all the xobjects pdfWriter.createImageXObjectFromJPG( __dirname + "/TestMaterials/images/otherStage.JPG", - imageXObjectID + imageXObjectID, ); pdfWriter.createFormXObjectFromJPG( __dirname + "/TestMaterials/images/otherStage.JPG", - formXObjectID + formXObjectID, ); pdfWriter.createFormXObjectFromTIFF( __dirname + "/TestMaterials/images/tiff/jim___ah.tif", - tiffFormXObjectID + tiffFormXObjectID, ); var xobjectForm = pdfWriter.createFormXObject( @@ -70,7 +70,7 @@ describe("ImagesAndFormsForwardReferenceTest", function () { 0, 200, 100, - simpleFormXObjectID + simpleFormXObjectID, ); xobjectForm .getContentContext() diff --git a/tests/InputFileTest.js b/tests/InputFileTest.js index ea4e7d5b..9c38c059 100644 --- a/tests/InputFileTest.js +++ b/tests/InputFileTest.js @@ -3,7 +3,7 @@ var muhammara = require("../lib/muhammara"); describe("InputFileTest", function () { it("should complete without error", function () { var inputFile = new muhammara.InputFile( - __dirname + "/TestMaterials/fonts/LucidaGrande.ttc" + __dirname + "/TestMaterials/fonts/LucidaGrande.ttc", ); if ( inputFile.getFilePath() != diff --git a/tests/LinksTest.js b/tests/LinksTest.js index 47c9987a..ec85a8a2 100644 --- a/tests/LinksTest.js +++ b/tests/LinksTest.js @@ -6,10 +6,10 @@ describe("LinksTest", function () { var page = pdfWriter.createPage(0, 0, 595, 842); var soundCloudLogo = pdfWriter.createFormXObjectFromJPG( - __dirname + "/TestMaterials/images/soundcloud_logo.jpg" + __dirname + "/TestMaterials/images/soundcloud_logo.jpg", ); var font = pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/arial.ttf" + __dirname + "/TestMaterials/fonts/arial.ttf", ); var contentContext = pdfWriter @@ -33,14 +33,14 @@ describe("LinksTest", function () { 87.75, 694.56, 198.76, - 720 + 720, ) .attachURLLinktoCurrentPage( "http://www.soundcloud.com", 90.024, 200, 367.524, - 375 + 375, ) .writePage(page) .end(); diff --git a/tests/MergePDFPages.js b/tests/MergePDFPages.js index 4539fa1d..8b18ba07 100644 --- a/tests/MergePDFPages.js +++ b/tests/MergePDFPages.js @@ -4,14 +4,14 @@ describe("MergePDFPages", function () { describe("OnlyMerge", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/TestOnlyMerge.pdf" + __dirname + "/output/TestOnlyMerge.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); pdfWriter.mergePDFPagesToPage( page, __dirname + "/TestMaterials/BasicTIFFImagesTest.PDF", - { type: muhammara.eRangeTypeSpecific, specificRanges: [[0, 0]] } + { type: muhammara.eRangeTypeSpecific, specificRanges: [[0, 0]] }, ); pdfWriter.writePage(page).end(); @@ -21,7 +21,7 @@ describe("MergePDFPages", function () { describe("PrefixGraphicsMerge", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/TestPrefixGraphicsMerge.pdf" + __dirname + "/output/TestPrefixGraphicsMerge.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); @@ -31,9 +31,9 @@ describe("MergePDFPages", function () { .k(0, 0, 0, 1) .Tf( pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/arial.ttf" + __dirname + "/TestMaterials/fonts/arial.ttf", ), - 30 + 30, ) .Tm(1, 0, 0, 1, 10, 600) .Tj("Testing file merge") @@ -43,7 +43,7 @@ describe("MergePDFPages", function () { pdfWriter.mergePDFPagesToPage( page, __dirname + "/TestMaterials/BasicTIFFImagesTest.PDF", - { type: muhammara.eRangeTypeSpecific, specificRanges: [[0, 0]] } + { type: muhammara.eRangeTypeSpecific, specificRanges: [[0, 0]] }, ); pdfWriter.writePage(page).end(); @@ -53,14 +53,14 @@ describe("MergePDFPages", function () { describe("SuffixGraphicsMerge", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/TestSuffixGraphicsMerge.pdf" + __dirname + "/output/TestSuffixGraphicsMerge.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); pdfWriter.mergePDFPagesToPage( page, __dirname + "/TestMaterials/BasicTIFFImagesTest.PDF", - { type: muhammara.eRangeTypeSpecific, specificRanges: [[0, 0]] } + { type: muhammara.eRangeTypeSpecific, specificRanges: [[0, 0]] }, ); pdfWriter @@ -69,9 +69,9 @@ describe("MergePDFPages", function () { .k(0, 0, 0, 1) .Tf( pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/arial.ttf" + __dirname + "/TestMaterials/fonts/arial.ttf", ), - 30 + 30, ) .Tm(1, 0, 0, 1, 10, 600) .Tj("Testing file merge") @@ -85,7 +85,7 @@ describe("MergePDFPages", function () { describe("BothGraphicsMerge", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/TestBothGraphicsMerge.pdf" + __dirname + "/output/TestBothGraphicsMerge.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); @@ -95,9 +95,9 @@ describe("MergePDFPages", function () { .k(0, 0, 0, 1) .Tf( pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/arial.ttf" + __dirname + "/TestMaterials/fonts/arial.ttf", ), - 30 + 30, ) .Tm(1, 0, 0, 1, 10, 600) .Tj("Testing file merge") @@ -108,7 +108,7 @@ describe("MergePDFPages", function () { pdfWriter.mergePDFPagesToPage( page, __dirname + "/TestMaterials/BasicTIFFImagesTest.PDF", - { type: muhammara.eRangeTypeSpecific, specificRanges: [[0, 0]] } + { type: muhammara.eRangeTypeSpecific, specificRanges: [[0, 0]] }, ); contentContext @@ -127,7 +127,7 @@ describe("MergePDFPages", function () { describe("TwoPageInSeparatePhases", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/MergeTwoPageInSeparatePhases.pdf" + __dirname + "/output/MergeTwoPageInSeparatePhases.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var contentContext = pdfWriter @@ -138,7 +138,7 @@ describe("MergePDFPages", function () { pdfWriter.mergePDFPagesToPage( page, __dirname + "/TestMaterials/BasicTIFFImagesTest.PDF", - { type: muhammara.eRangeTypeSpecific, specificRanges: [[0, 0]] } + { type: muhammara.eRangeTypeSpecific, specificRanges: [[0, 0]] }, ); contentContext.Q().q().cm(0.5, 0, 0, 0.5, 0, 421); @@ -146,7 +146,7 @@ describe("MergePDFPages", function () { pdfWriter.mergePDFPagesToPage( page, __dirname + "/TestMaterials/BasicTIFFImagesTest.PDF", - { type: muhammara.eRangeTypeSpecific, specificRanges: [[1, 1]] } + { type: muhammara.eRangeTypeSpecific, specificRanges: [[1, 1]] }, ); contentContext.Q(); @@ -158,7 +158,7 @@ describe("MergePDFPages", function () { describe("TwoPageWithCallback", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/MergeTwoPageWithCallback.pdf" + __dirname + "/output/MergeTwoPageWithCallback.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var contentContext = pdfWriter @@ -176,7 +176,7 @@ describe("MergePDFPages", function () { contentContext.Q().q().cm(0.5, 0, 0, 0.5, 0, 421); } ++pageIndex; - } + }, ); contentContext.Q(); @@ -187,14 +187,14 @@ describe("MergePDFPages", function () { describe("PagesUsingCopyingContext", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/MergePagesUsingCopyingContext.pdf" + __dirname + "/output/MergePagesUsingCopyingContext.pdf", ); var copyingContext = pdfWriter.createPDFCopyingContext( - __dirname + "/TestMaterials/BasicTIFFImagesTest.PDF" + __dirname + "/TestMaterials/BasicTIFFImagesTest.PDF", ); var formObjectId = copyingContext.createFormXObjectFromPDFPage( 0, - muhammara.ePDFPageBoxMediaBox + muhammara.ePDFPageBoxMediaBox, ); var page = pdfWriter.createPage(0, 0, 595, 842); @@ -210,7 +210,7 @@ describe("MergePDFPages", function () { .q() .cm(0.5, 0, 0, 0.5, 297.5, 421) .doXObject( - page.getResourcesDictionary().addFormXObjectMapping(formObjectId) + page.getResourcesDictionary().addFormXObjectMapping(formObjectId), ) .Q(); @@ -228,7 +228,7 @@ describe("MergePDFPages", function () { .q() .cm(0.5, 0, 0, 0.5, 297.5, 421) .doXObject( - page.getResourcesDictionary().addFormXObjectMapping(formObjectId) + page.getResourcesDictionary().addFormXObjectMapping(formObjectId), ) .Q(); @@ -239,12 +239,12 @@ describe("MergePDFPages", function () { describe("MergeFromStream", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/TestStreamMerge.pdf" + __dirname + "/output/TestStreamMerge.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var inStream = new muhammara.PDFRStreamForFile( - __dirname + "/TestMaterials/AddedPage.pdf" + __dirname + "/TestMaterials/AddedPage.pdf", ); pdfWriter.mergePDFPagesToPage(page, inStream, { diff --git a/tests/MergeToPDFForm.js b/tests/MergeToPDFForm.js index e55b58c0..8bbdbe7b 100644 --- a/tests/MergeToPDFForm.js +++ b/tests/MergeToPDFForm.js @@ -1,11 +1,11 @@ describe("MergeToPDFForm", function () { it("should complete without error", function () { var pdfWriter = require("../lib/muhammara.js").createWriter( - __dirname + "/output/MergeToPDFForm.pdf" + __dirname + "/output/MergeToPDFForm.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var copyingContext = pdfWriter.createPDFCopyingContext( - __dirname + "/TestMaterials/Linearized.pdf" + __dirname + "/TestMaterials/Linearized.pdf", ); var form = pdfWriter.createFormXObject(0, 0, 297.5, 842); diff --git a/tests/ModifyExistingPageContent.js b/tests/ModifyExistingPageContent.js index 3635c44a..0aa3a2a5 100644 --- a/tests/ModifyExistingPageContent.js +++ b/tests/ModifyExistingPageContent.js @@ -7,7 +7,7 @@ describe("ModifyExistingPageContent", function () { { modifiedFilePath: __dirname + "/output/BasicJPGImagesTestPageModified.pdf", - } + }, ); var pageModifier = new muhammara.PDFPageModifier(pdfWriter, 0); @@ -16,7 +16,7 @@ describe("ModifyExistingPageContent", function () { .getContext() .writeText("Test Text", 75, 805, { font: pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/Couri.ttf" + __dirname + "/TestMaterials/fonts/Couri.ttf", ), size: 14, colorspace: "gray", diff --git a/tests/ModifyingExistingFileContent.js b/tests/ModifyingExistingFileContent.js index e603deab..fe03b96d 100644 --- a/tests/ModifyingExistingFileContent.js +++ b/tests/ModifyingExistingFileContent.js @@ -8,7 +8,7 @@ function PDFComment( inPosition, inColor, flag, - inReplyTo + inReplyTo, ) { this.time = new Date(); this.text = inText; @@ -56,7 +56,7 @@ PDFCommentWriter.prototype._writeCommentsTree = function (inComment) { .writeRectangleValue(inComment.position) // when implementing allow also 4 numbers input .writeKey("Contents") .writeLiteralStringValue( - this.pdfWriter.createPDFTextString(inComment.text).toBytesArray() + this.pdfWriter.createPDFTextString(inComment.text).toBytesArray(), ) .writeKey("C"); @@ -69,11 +69,11 @@ PDFCommentWriter.prototype._writeCommentsTree = function (inComment) { dictionaryContext .writeKey("T") .writeLiteralStringValue( - this.pdfWriter.createPDFTextString(inComment.commentator).toBytesArray() + this.pdfWriter.createPDFTextString(inComment.commentator).toBytesArray(), ) .writeKey("M") .writeLiteralStringValue( - this.pdfWriter.createPDFDate(inComment.time).toString() + this.pdfWriter.createPDFDate(inComment.time).toString(), ); if (inComment.replyTo) { @@ -137,7 +137,7 @@ describe("ModifyingExistingFileContent", function () { { modifiedFilePath: __dirname + "/output/ModifyingExistingFileContent.pdf", - } + }, ); }); describe("page size modification", function () { @@ -158,16 +158,14 @@ describe("ModifyingExistingFileContent", function () { .getObjectsContext() .startDictionary(); - Object.getOwnPropertyNames(thirdPageObject).forEach(function ( - element, - index, - array - ) { - if (element != "MediaBox") { - modifiedPageObject.writeKey(element); - copyingContext.copyDirectObjectAsIs(thirdPageObject[element]); - } - }); + Object.getOwnPropertyNames(thirdPageObject).forEach( + function (element, index, array) { + if (element != "MediaBox") { + modifiedPageObject.writeKey(element); + copyingContext.copyDirectObjectAsIs(thirdPageObject[element]); + } + }, + ); modifiedPageObject.writeKey("MediaBox"); objectsContext .startArray() @@ -189,7 +187,7 @@ describe("ModifyingExistingFileContent", function () { "someone", [100, 500, 200, 600], [255, 0, 0], - "noview" + "noview", ); commentWriter.writeCommentTree(aComment); var bComment = new PDFComment( @@ -197,7 +195,7 @@ describe("ModifyingExistingFileContent", function () { "someone", [100, 100, 200, 200], [255, 0, 0], - "readOnly" + "readOnly", ); var cComment = new PDFComment( "yeah. me too. it's just perfect", @@ -205,7 +203,7 @@ describe("ModifyingExistingFileContent", function () { [150, 150, 250, 250], [0, 255, 0], "nozoom", - bComment + bComment, ); commentWriter.writeCommentTree(cComment); @@ -226,16 +224,14 @@ describe("ModifyingExistingFileContent", function () { .getObjectsContext() .startDictionary(); - Object.getOwnPropertyNames(fourthPageObject).forEach(function ( - element, - index, - array - ) { - if (element != "Annots") { - modifiedPageObject.writeKey(element); - copyingContext.copyDirectObjectAsIs(fourthPageObject[element]); - } - }); + Object.getOwnPropertyNames(fourthPageObject).forEach( + function (element, index, array) { + if (element != "Annots") { + modifiedPageObject.writeKey(element); + copyingContext.copyDirectObjectAsIs(fourthPageObject[element]); + } + }, + ); modifiedPageObject.writeKey("Annots"); objectsContext.startArray(); diff --git a/tests/PDFCopyingContextTest.js b/tests/PDFCopyingContextTest.js index 6150c8ac..dc15e4d6 100644 --- a/tests/PDFCopyingContextTest.js +++ b/tests/PDFCopyingContextTest.js @@ -1,10 +1,10 @@ describe("PDFCopyingContextTest", function () { it("should complete without error", function () { var pdfWriter = require("../lib/muhammara").createWriter( - __dirname + "/output/PDFCopyingContextTest.PDF" + __dirname + "/output/PDFCopyingContextTest.PDF", ); var copyingContext = pdfWriter.createPDFCopyingContext( - __dirname + "/TestMaterials/BasicTIFFImagesTest.PDF" + __dirname + "/TestMaterials/BasicTIFFImagesTest.PDF", ); copyingContext.appendPDFPageFromPDF(1); copyingContext.appendPDFPageFromPDF(18); diff --git a/tests/PDFEmbedTest.js b/tests/PDFEmbedTest.js index 3332821e..daedab94 100644 --- a/tests/PDFEmbedTest.js +++ b/tests/PDFEmbedTest.js @@ -3,11 +3,11 @@ var muhammara = require("../lib/muhammara"); describe("PDFEmbedTest", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/PDFEmbedTest.pdf" + __dirname + "/output/PDFEmbedTest.pdf", ); var formIDs = pdfWriter.createFormXObjectsFromPDF( __dirname + "/TestMaterials/XObjectContent.PDF", - muhammara.ePDFPageBoxMediaBox + muhammara.ePDFPageBoxMediaBox, ); var page = pdfWriter.createPage(0, 0, 595, 842); @@ -16,7 +16,7 @@ describe("PDFEmbedTest", function () { .q() .cm(0.5, 0, 0, 0.5, 0, 421) .doXObject( - page.getResourcesDictionary().addFormXObjectMapping(formIDs[0]) + page.getResourcesDictionary().addFormXObjectMapping(formIDs[0]), ) .Q() .G(0) @@ -26,7 +26,7 @@ describe("PDFEmbedTest", function () { .q() .cm(0.5, 0, 0, 0.5, 297.5, 0) .doXObject( - page.getResourcesDictionary().addFormXObjectMapping(formIDs[1]) + page.getResourcesDictionary().addFormXObjectMapping(formIDs[1]), ) .Q() .G(0) diff --git a/tests/PDFParser.js b/tests/PDFParser.js index d02cee8e..fda0a148 100644 --- a/tests/PDFParser.js +++ b/tests/PDFParser.js @@ -52,14 +52,12 @@ describe("PDFParser", function () { ++mTabLevel; var aDictionary = inObject.toPDFDictionary().toJSObject(); - Object.getOwnPropertyNames(aDictionary).forEach(function ( - element, - index, - array - ) { - logToFile(element); - iterateObjectTypes(aDictionary[element], inReader); - }); + Object.getOwnPropertyNames(aDictionary).forEach( + function (element, index, array) { + logToFile(element); + iterateObjectTypes(aDictionary[element], inReader); + }, + ); --mTabLevel; } else if (inObject.getType() == muhammara.ePDFObjectStream) { output += "Stream . iterating stream dictionary:"; @@ -72,13 +70,13 @@ describe("PDFParser", function () { } var pdfReader = muhammara.createReader( - __dirname + "/TestMaterials/XObjectContent.PDF" + __dirname + "/TestMaterials/XObjectContent.PDF", ); assert.equal(pdfReader.getPDFLevel(), 1.3, "getPDFLevel"); assert.equal(pdfReader.getPagesCount(), 2, "getPagesCount"); var catalog = pdfReader.queryDictionaryObject( pdfReader.getTrailer(), - "Root" + "Root", ); iterateObjectTypes(catalog, pdfReader); fs.closeSync(outputFile); @@ -88,7 +86,7 @@ describe("PDFParser", function () { var pdfReader; assert.doesNotThrow(function () { pdfReader = muhammara.createReader( - __dirname + "/TestMaterials/XObjectContentWithExtra.PDF" + __dirname + "/TestMaterials/XObjectContentWithExtra.PDF", ); }); assert.equal(pdfReader.getPDFLevel(), 1.3, "getPDFLevel"); diff --git a/tests/PDFTextString.js b/tests/PDFTextString.js index 5792cfb7..048ece9b 100644 --- a/tests/PDFTextString.js +++ b/tests/PDFTextString.js @@ -7,21 +7,21 @@ describe("PDFTextString", function () { assert.equal( new PDFTextString("Hello World").toString(), "Hello World", - "string starter" + "string starter", ); assert.equal( new PDFTextString([ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, ]).toString(), "Hello World", - "bytes array starter" + "bytes array starter", ); assert.equal( new PDFTextString( - new PDFTextString("Hello World").toBytesArray() + new PDFTextString("Hello World").toBytesArray(), ).toString(), "Hello World", - "bytes array starter, again" + "bytes array starter, again", ); }); }); diff --git a/tests/PageBoxes.js b/tests/PageBoxes.js index 8f451ff8..06dce0b7 100644 --- a/tests/PageBoxes.js +++ b/tests/PageBoxes.js @@ -5,7 +5,7 @@ describe("PagesBoxes", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( __dirname + "/output/PageBoxes.pdf", - { version: muhammara.ePDFVersion14 } + { version: muhammara.ePDFVersion14 }, ); var page = pdfWriter.createPage(); diff --git a/tests/ParseInfo.js b/tests/ParseInfo.js index fa92569c..6980229b 100644 --- a/tests/ParseInfo.js +++ b/tests/ParseInfo.js @@ -5,7 +5,7 @@ var fs = require("fs"); describe("ParseInfo", function () { it("should read fields correctly", function () { var pdfReader = muhammara.createReader( - __dirname + "/TestMaterials/SettingInfoValues.pdf" + __dirname + "/TestMaterials/SettingInfoValues.pdf", ); var info = pdfReader .queryDictionaryObject(pdfReader.getTrailer(), "Info") @@ -18,7 +18,7 @@ describe("ParseInfo", function () { assert.equal( info.CreationDate.value, "D:20140720204655+03'00'", - "creation date value" + "creation date value", ); }); }); diff --git a/tests/SettingInfoValuesFromParsedContentTest.js b/tests/SettingInfoValuesFromParsedContentTest.js index beff327d..53482567 100644 --- a/tests/SettingInfoValuesFromParsedContentTest.js +++ b/tests/SettingInfoValuesFromParsedContentTest.js @@ -5,19 +5,19 @@ var fs = require("fs"); describe("SettingInfoValuesFromParsedContent", function () { it("should complete without error", function () { var outStream = new muhammara.PDFWStreamForFile( - __dirname + "/output/SettingInfoValuesFromParsedContent.pdf" + __dirname + "/output/SettingInfoValuesFromParsedContent.pdf", ); var pdfWriter = muhammara.createWriter(outStream); var copyCtx = pdfWriter.createPDFCopyingContext( - __dirname + "/TestMaterials/SettingInfoValues.pdf" + __dirname + "/TestMaterials/SettingInfoValues.pdf", ); var info = copyCtx .getSourceDocumentParser() .queryDictionaryObject( copyCtx.getSourceDocumentParser().getTrailer(), - "Info" + "Info", ) .toJSObject(); @@ -36,7 +36,7 @@ describe("SettingInfoValuesFromParsedContent", function () { assert.equal( info.CreationDate.value, "D:20140720204655+03'00'", - "creation date encoded" + "creation date encoded", ); var page = pdfWriter.createPage(); diff --git a/tests/SettingInfoValuesTest.js b/tests/SettingInfoValuesTest.js index 0f17a78a..a0ff8634 100644 --- a/tests/SettingInfoValuesTest.js +++ b/tests/SettingInfoValuesTest.js @@ -4,7 +4,7 @@ describe("SettingInfoValues", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( __dirname + "/output/SettingInfoValues.pdf", - { version: muhammara.ePDFVersion14 } + { version: muhammara.ePDFVersion14 }, ); // set the document author, title, subject, creator, creation date, additional info diff --git a/tests/ShutdownRestartTest.js b/tests/ShutdownRestartTest.js index 4a4e1179..23cf24e6 100644 --- a/tests/ShutdownRestartTest.js +++ b/tests/ShutdownRestartTest.js @@ -3,11 +3,11 @@ var muhammara = require("../lib/muhammara"); describe("ShutDownRestartState", function () { it("should complete without error", function () { var pdfWriterA = muhammara.createWriter( - __dirname + "/output/SimpleContentShutdownRestart.PDF" + __dirname + "/output/SimpleContentShutdownRestart.PDF", ); var page = pdfWriterA.createPage(0, 0, 595, 842); var font = pdfWriterA.getFontForFile( - __dirname + "/TestMaterials/fonts/arial.ttf" + __dirname + "/TestMaterials/fonts/arial.ttf", ); pdfWriterA @@ -44,7 +44,7 @@ describe("ShutDownRestartState", function () { var pdfWriterB = muhammara.createWriterToContinue( __dirname + "/output/SimpleContentShutdownRestart.PDF", - __dirname + "/output/ShutDownRestartState.txt" + __dirname + "/output/ShutDownRestartState.txt", ); var page = pdfWriterB.createPage(0, 0, 595, 842); diff --git a/tests/SigSeg.js b/tests/SigSeg.js index 9229676d..debc62a6 100644 --- a/tests/SigSeg.js +++ b/tests/SigSeg.js @@ -5,8 +5,8 @@ describe("SigSegv test", function () { it("should read fields correctly", function () { expect(() => muhammara.createReader( - __dirname + "/TestMaterials/BrokenPdfBadHeader.txt" - ) + __dirname + "/TestMaterials/BrokenPdfBadHeader.txt", + ), ).to.throw(); }); }); diff --git a/tests/SimpleContentPageTest.js b/tests/SimpleContentPageTest.js index 83bca420..4c41b0f6 100644 --- a/tests/SimpleContentPageTest.js +++ b/tests/SimpleContentPageTest.js @@ -3,7 +3,7 @@ var muhammara = require("../lib/muhammara"); describe("SimpleContentPageTest", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/SimpleContentPageTest.pdf" + __dirname + "/output/SimpleContentPageTest.pdf", ); var page = new muhammara.PDFPage(0, 0, 595, 842); var pageContent = pdfWriter.startPageContentContext(page); diff --git a/tests/SimpleTextUsageTest.js b/tests/SimpleTextUsageTest.js index 715efc69..ef3be832 100644 --- a/tests/SimpleTextUsageTest.js +++ b/tests/SimpleTextUsageTest.js @@ -3,14 +3,14 @@ var muhammara = require("../lib/muhammara"); describe("SimpleTextUsageTest", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/SimpleTextUsageCFF.pdf" + __dirname + "/output/SimpleTextUsageCFF.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var font = pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/BrushScriptStd.otf" + __dirname + "/TestMaterials/fonts/BrushScriptStd.otf", ); var fontK = pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/KozGoPro-Regular.otf" + __dirname + "/TestMaterials/fonts/KozGoPro-Regular.otf", ); pdfWriter .startPageContentContext(page) @@ -31,12 +31,12 @@ describe("SimpleTextUsageTest", function () { // --- var pdfWriter = muhammara.createWriter( - __dirname + "/output/SimpleTextUsageTTF.pdf" + __dirname + "/output/SimpleTextUsageTTF.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var font = pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/arial.ttf" + __dirname + "/TestMaterials/fonts/arial.ttf", ); pdfWriter .startPageContentContext(page) @@ -52,12 +52,12 @@ describe("SimpleTextUsageTest", function () { // --- var pdfWriter = muhammara.createWriter( - __dirname + "/output/SimpleTextUsageType1.pdf" + __dirname + "/output/SimpleTextUsageType1.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var font = pdfWriter.getFontForFile( __dirname + "/TestMaterials/fonts/HLB_____.PFB", - __dirname + "/TestMaterials/fonts/HLB_____.PFM" + __dirname + "/TestMaterials/fonts/HLB_____.PFM", ); pdfWriter .startPageContentContext(page) @@ -74,12 +74,12 @@ describe("SimpleTextUsageTest", function () { // this one is about creating a font object, but not really using it. make sure no crash happens var pdfWriter = muhammara.createWriter( - __dirname + "/output/SimpleTextUsageType1Empty.pdf" + __dirname + "/output/SimpleTextUsageType1Empty.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var font = pdfWriter.getFontForFile( __dirname + "/TestMaterials/fonts/HLB_____.PFB", - __dirname + "/TestMaterials/fonts/HLB_____.PFM" + __dirname + "/TestMaterials/fonts/HLB_____.PFM", ); pdfWriter .startPageContentContext(page) @@ -95,11 +95,11 @@ describe("SimpleTextUsageTest", function () { // this one adds text using the GlyphIds var pdfWriter = muhammara.createWriter( - __dirname + "/output/SimpleTextUsageGlyphs.pdf" + __dirname + "/output/SimpleTextUsageGlyphs.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var font = pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/arial.ttf" + __dirname + "/TestMaterials/fonts/arial.ttf", ); pdfWriter .startPageContentContext(page) diff --git a/tests/StreamCopyingContext.js b/tests/StreamCopyingContext.js index 281462f0..6eb2b860 100644 --- a/tests/StreamCopyingContext.js +++ b/tests/StreamCopyingContext.js @@ -4,19 +4,19 @@ var fs = require("fs"); describe("StreamCopyingContext", function () { it("should complete without error", function () { var inStreamA = new muhammara.PDFRStreamForFile( - __dirname + "/TestMaterials/BasicJPGImagesTest.PDF" + __dirname + "/TestMaterials/BasicJPGImagesTest.PDF", ); var inStreamB = new muhammara.PDFRStreamForFile( - __dirname + "/TestMaterials/AddedPage.pdf" + __dirname + "/TestMaterials/AddedPage.pdf", ); var outStream = new muhammara.PDFWStreamForFile( - __dirname + "/output/StreamCopyingContext.pdf" + __dirname + "/output/StreamCopyingContext.pdf", ); var pdfWriter = muhammara.createWriterToModify(inStreamB, outStream); var copyCtx = pdfWriter.createPDFCopyingContext( - __dirname + "/TestMaterials/BasicJPGImagesTest.PDF" + __dirname + "/TestMaterials/BasicJPGImagesTest.PDF", ); copyCtx.appendPDFPageFromPDF(0); diff --git a/tests/TTCFontTest.js b/tests/TTCFontTest.js index 500d0ad0..81a5712d 100644 --- a/tests/TTCFontTest.js +++ b/tests/TTCFontTest.js @@ -1,17 +1,17 @@ describe("TTCFontTest", function () { it("should complete without error", function () { var pdfWriter = require("../lib/muhammara").createWriter( - __dirname + "/output/TTCTestLucidaGrande.PDF" + __dirname + "/output/TTCTestLucidaGrande.PDF", ); var page = pdfWriter.createPage(0, 0, 595, 842); var fontLucidaGrande0 = pdfWriter.getFontForFile( __dirname + "/TestMaterials/fonts/LucidaGrande.ttc", - 0 + 0, ); var fontLucidaGrande1 = pdfWriter.getFontForFile( __dirname + "/TestMaterials/fonts/LucidaGrande.ttc", - 1 + 1, ); pdfWriter diff --git a/tests/TextMeasurementsTest.js b/tests/TextMeasurementsTest.js index f91cdfe1..39354f7a 100644 --- a/tests/TextMeasurementsTest.js +++ b/tests/TextMeasurementsTest.js @@ -1,12 +1,12 @@ describe("TextMeasurementsTest", function () { it("should complete without error", function () { var pdfWriter = require("../lib/muhammara").createWriter( - __dirname + "/output/TextMeasurementsTest.pdf" + __dirname + "/output/TextMeasurementsTest.pdf", ); var page = pdfWriter.createPage(0, 0, 595, 842); var cxt = pdfWriter.startPageContentContext(page); var arialFont = pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/arial.ttf" + __dirname + "/TestMaterials/fonts/arial.ttf", ); var pathStrokeOptions = { color: "DarkMagenta", width: 4 }; @@ -26,14 +26,14 @@ describe("TextMeasurementsTest", function () { 98 + textDimensions.yMin, 10 + textDimensions.xMax, 98 + textDimensions.yMin, - pathStrokeOptions + pathStrokeOptions, ) .drawPath( 10 + textDimensions.xMin, 102 + textDimensions.yMax, 10 + textDimensions.xMax, 102 + textDimensions.yMax, - pathStrokeOptions + pathStrokeOptions, ); pdfWriter.writePage(page); diff --git a/tests/TiffImageTest.js b/tests/TiffImageTest.js index 1f72c8bd..ab7e0ef2 100644 --- a/tests/TiffImageTest.js +++ b/tests/TiffImageTest.js @@ -15,138 +15,144 @@ function addPageForTiff(inPDFWriter, inTiffPath) { describe("TiffImageTest", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/TiffImageTest.PDF" + __dirname + "/output/TiffImageTest.PDF", ); for (var i = 1; i < 9; ++i) { addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/CCITT_" + i + ".TIF" + __dirname + "/TestMaterials/images/tiff/CCITT_" + i + ".TIF", ); } addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/FLAG_T24.TIF" + __dirname + "/TestMaterials/images/tiff/FLAG_T24.TIF", ); addPageForTiff(pdfWriter, __dirname + "/TestMaterials/images/tiff/G4.TIF"); addPageForTiff(pdfWriter, __dirname + "/TestMaterials/images/tiff/G4S.TIF"); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/G31D.TIF" + __dirname + "/TestMaterials/images/tiff/G31D.TIF", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/G31DS.TIF" + __dirname + "/TestMaterials/images/tiff/G31DS.TIF", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/G32D.TIF" + __dirname + "/TestMaterials/images/tiff/G32D.TIF", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/GMARBLES.TIF" + __dirname + "/TestMaterials/images/tiff/GMARBLES.TIF", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/MARBIBM.TIF" + __dirname + "/TestMaterials/images/tiff/MARBIBM.TIF", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/MARBLES.TIF" + __dirname + "/TestMaterials/images/tiff/MARBLES.TIF", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/XING_T24.TIF" + __dirname + "/TestMaterials/images/tiff/XING_T24.TIF", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/cramps-tile.tif" + __dirname + "/TestMaterials/images/tiff/cramps-tile.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/cramps.tif" + __dirname + "/TestMaterials/images/tiff/cramps.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/dscf0013.tif" + __dirname + "/TestMaterials/images/tiff/dscf0013.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/fax2d.tif" + __dirname + "/TestMaterials/images/tiff/fax2d.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/g3test.tif" + __dirname + "/TestMaterials/images/tiff/g3test.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/jello.tif" + __dirname + "/TestMaterials/images/tiff/jello.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/jim___ah.tif" + __dirname + "/TestMaterials/images/tiff/jim___ah.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/jim___cg.tif" + __dirname + "/TestMaterials/images/tiff/jim___cg.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/jim___dg.tif" + __dirname + "/TestMaterials/images/tiff/jim___dg.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/jim___gg.tif" + __dirname + "/TestMaterials/images/tiff/jim___gg.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/oxford.tif" + __dirname + "/TestMaterials/images/tiff/oxford.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/quad-lzw.tif" + __dirname + "/TestMaterials/images/tiff/quad-lzw.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/quad-tile.tif" + __dirname + "/TestMaterials/images/tiff/quad-tile.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/strike.tif" + __dirname + "/TestMaterials/images/tiff/strike.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/ycbcr-cat.tif" + __dirname + "/TestMaterials/images/tiff/ycbcr-cat.tif", ); for (var i = 2; i < 9; i = i * 2) { addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/flower-minisblack-" + i + ".tif" + __dirname + + "/TestMaterials/images/tiff/flower-minisblack-" + + i + + ".tif", ); } for (var i = 2; i < 9; i = i * 2) { addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/flower-palette-" + i + ".tif" + __dirname + "/TestMaterials/images/tiff/flower-palette-" + i + ".tif", ); } for (var i = 2; i < 9; i = i * 2) { addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/flower-rgb-contig-" + i + ".tif" + __dirname + + "/TestMaterials/images/tiff/flower-rgb-contig-" + + i + + ".tif", ); } addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/flower-rgb-planar-8.tif" + __dirname + "/TestMaterials/images/tiff/flower-rgb-planar-8.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/flower-separated-contig-8.tif" + __dirname + "/TestMaterials/images/tiff/flower-separated-contig-8.tif", ); addPageForTiff( pdfWriter, - __dirname + "/TestMaterials/images/tiff/flower-separated-planar-8.tif" + __dirname + "/TestMaterials/images/tiff/flower-separated-planar-8.tif", ); pdfWriter.end(); }); diff --git a/tests/TiffSpecialsTest.js b/tests/TiffSpecialsTest.js index 4cf626b4..aaffab04 100644 --- a/tests/TiffSpecialsTest.js +++ b/tests/TiffSpecialsTest.js @@ -14,17 +14,17 @@ describe("TiffSpecialsTest", function () { } var pdfWriter = require("../lib/muhammara").createWriter( - __dirname + "/output/TiffSpecialsTest.pdf" + __dirname + "/output/TiffSpecialsTest.pdf", ); var pageCount = pdfWriter.getImagePagesCount( - __dirname + "/TestMaterials/images/tiff/multipage.tif" + __dirname + "/TestMaterials/images/tiff/multipage.tif", ); assert.equal(pageCount, 4, "expected number of pages"); for (var i = 0; i < 4; ++i) { var imageForm = pdfWriter.createFormXObjectFromTIFF( __dirname + "/TestMaterials/images/tiff/multipage.tif", - { pageIndex: i } + { pageIndex: i }, ); createPageFormImage(pdfWriter, imageForm); } @@ -73,7 +73,7 @@ describe("TiffSpecialsTest", function () { oneColor: [255, 255, 0, 0], zeroColor: [0, 0, 0, 0], }, - } + }, ); var imageGrayScaleGreenVSRed = pdfWriter.createFormXObjectFromTIFF( imagePath, @@ -83,7 +83,7 @@ describe("TiffSpecialsTest", function () { oneColor: [0, 255, 0], zeroColor: [255, 0, 0], }, - } + }, ); var imageGrayScaleCyanVSMagenta = pdfWriter.createFormXObjectFromTIFF( imagePath, @@ -93,7 +93,7 @@ describe("TiffSpecialsTest", function () { oneColor: [255, 0, 0, 0], zeroColor: [0, 255, 0, 0], }, - } + }, ); var page = pdfWriter.createPage(0, 0, 595, 842); diff --git a/tests/WriterEvents.js b/tests/WriterEvents.js index eb5c15fd..45823ccd 100644 --- a/tests/WriterEvents.js +++ b/tests/WriterEvents.js @@ -3,7 +3,7 @@ var assert = require("chai").assert; describe("WriterEvents", function () { it("should complete without error", function () { var pdfWriter = require("../lib/muhammara").createWriter( - __dirname + "/output/WriterEvents.pdf" + __dirname + "/output/WriterEvents.pdf", ); var onCatalogWriteCalled = 0; var onPageWriteCalled = 0; @@ -12,7 +12,7 @@ describe("WriterEvents", function () { assert.equal( !!eventParams.catalogDictionaryContext, true, - "catalogDictionaryContext exists" + "catalogDictionaryContext exists", ); ++onCatalogWriteCalled; }); @@ -22,7 +22,7 @@ describe("WriterEvents", function () { assert.equal( !!eventParams.pageDictionaryContext, true, - "pageDictionaryContext exists" + "pageDictionaryContext exists", ); ++onPageWriteCalled; }); @@ -32,7 +32,7 @@ describe("WriterEvents", function () { var textOptions = { font: pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/arial.ttf" + __dirname + "/TestMaterials/fonts/arial.ttf", ), size: 14, colorspace: "gray", @@ -60,7 +60,7 @@ describe("WriterEvents", function () { 440, 223, 540, - pathStrokeOptions + pathStrokeOptions, ); pdfWriter.writePage(page); diff --git a/tests/Xcryption.js b/tests/Xcryption.js index b4dacce9..fd1ac748 100644 --- a/tests/Xcryption.js +++ b/tests/Xcryption.js @@ -8,7 +8,7 @@ describe("Xcryption", function () { __dirname + "/output/RecryptPDFWithPasswordToNothing.PDF", { password: "user", - } + }, ); }); }); @@ -17,11 +17,11 @@ describe("Xcryption", function () { it("should complete without error", function () { var fs = require("fs"); var result = fs.readFileSync( - __dirname + "/TestMaterials/PDFWithPassword.PDF" + __dirname + "/TestMaterials/PDFWithPassword.PDF", ); var source = new muhammara.PDFRStreamForBuffer(result); var target = new muhammara.PDFWStreamForFile( - __dirname + "/output/RecryptPDFOriginalToPasswordProtectedBuffer.PDF" + __dirname + "/output/RecryptPDFOriginalToPasswordProtectedBuffer.PDF", ); muhammara.recrypt(source, target, { password: "user", @@ -35,10 +35,10 @@ describe("Xcryption", function () { describe("Encrypt PDF With a Password as stream", function () { it("should complete without error", function () { var source = new muhammara.PDFRStreamForFile( - __dirname + "/TestMaterials/PDFWithPassword.PDF" + __dirname + "/TestMaterials/PDFWithPassword.PDF", ); var target = new muhammara.PDFWStreamForFile( - __dirname + "/output/RecryptPDFOriginalToPasswordProtectedStream.PDF" + __dirname + "/output/RecryptPDFOriginalToPasswordProtectedStream.PDF", ); muhammara.recrypt(source, target, { password: "user", @@ -59,7 +59,7 @@ describe("Xcryption", function () { userPassword: "user1", ownerPassword: "owner1", userProtectionFlag: 4, - } + }, ); }); }); @@ -73,7 +73,7 @@ describe("Xcryption", function () { userPassword: "user1", ownerPassword: "owner1", userProtectionFlag: 4, - } + }, ); }); }); @@ -86,7 +86,7 @@ describe("Xcryption", function () { userPassword: "user", ownerPassword: "owner", userProtectionFlag: 4, - } + }, ); var page = pdfWriter.createPage(0, 0, 595, 842); @@ -95,11 +95,11 @@ describe("Xcryption", function () { .drawImage( 10, 100, - __dirname + "/TestMaterials/images/soundcloud_logo.jpg" + __dirname + "/TestMaterials/images/soundcloud_logo.jpg", ) .writeText("Hello", 10, 50, { font: pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/arial.ttf" + __dirname + "/TestMaterials/fonts/arial.ttf", ), size: 14, colorspace: "gray", @@ -120,7 +120,7 @@ describe("Xcryption", function () { ownerPassword: "owner", userProtectionFlag: 4, version: muhammara.ePDFVersion16, - } + }, ); var page = pdfWriter.createPage(0, 0, 595, 842); @@ -129,11 +129,11 @@ describe("Xcryption", function () { .drawImage( 10, 100, - __dirname + "/TestMaterials/images/soundcloud_logo.jpg" + __dirname + "/TestMaterials/images/soundcloud_logo.jpg", ) .writeText("Hello", 10, 50, { font: pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/arial.ttf" + __dirname + "/TestMaterials/fonts/arial.ttf", ), size: 14, colorspace: "gray", @@ -148,10 +148,10 @@ describe("Xcryption", function () { describe("Decrypt PDF via Appending Pages to New PDF", function () { it("should complete without error", function () { var pdfWriter = muhammara.createWriter( - __dirname + "/output/PDFWithPasswordDecrypted.pdf" + __dirname + "/output/PDFWithPasswordDecrypted.pdf", ); var copyingContext = pdfWriter.createPDFCopyingContext( - __dirname + "/TestMaterials/BasicTIFFImagesTest.PDF" + __dirname + "/TestMaterials/BasicTIFFImagesTest.PDF", ); for ( var i = 0; @@ -171,7 +171,7 @@ describe("Xcryption", function () { { modifiedFilePath: __dirname + "/output/PDFWithPasswordModified.pdf", userPassword: "user", - } + }, ); // modify first page to include text @@ -181,7 +181,7 @@ describe("Xcryption", function () { .getContext() .writeText("new text on encrypted page", 10, 805, { font: pdfWriter.getFontForFile( - __dirname + "/TestMaterials/fonts/arial.ttf" + __dirname + "/TestMaterials/fonts/arial.ttf", ), size: 14, colorspace: "gray", @@ -198,7 +198,7 @@ describe("Xcryption", function () { .drawImage( 10, 300, - __dirname + "/TestMaterials/images/soundcloud_logo.jpg" + __dirname + "/TestMaterials/images/soundcloud_logo.jpg", ); pdfWriter.writePage(page); diff --git a/tests/recipe/annotation-comment.js b/tests/recipe/annotation-comment.js index 72b03bad..790b8b96 100644 --- a/tests/recipe/annotation-comment.js +++ b/tests/recipe/annotation-comment.js @@ -13,7 +13,7 @@ describe("Annotation: Comment", () => { "Except for the background rectangle exposing it, the annotation above would normally be invisible because no color option was given to it.", 175, 150, - { textBox: { width: 280, textAlign: "center" } } + { textBox: { width: 280, textAlign: "center" } }, ) .rectangle(290, 90, 50, 50, { fill: "red", opacity: 0.2 }) .comment("Feel free to open issues to help us!", "center", 100, { @@ -28,7 +28,7 @@ describe("Annotation: Comment", () => { const src = path.join(__dirname, "../TestMaterials/recipe/test.pdf"); const output = path.join( __dirname, - "../output/Add comment with rich text.pdf" + "../output/Add comment with rich text.pdf", ); const recipe = new HummusRecipe(src, output); const textContent = [ @@ -83,7 +83,7 @@ describe("Annotation: Comment", () => { .text( "Trace-based Just-in-Time Type Specialization for Dynamic Languages", 100, - "center" + "center", ) .annot(100, "center", "Highlight", { text: "Oh~la", diff --git a/tests/recipe/annotation-coordinate.js b/tests/recipe/annotation-coordinate.js index f6e1d04f..a9d8a5da 100644 --- a/tests/recipe/annotation-coordinate.js +++ b/tests/recipe/annotation-coordinate.js @@ -8,11 +8,11 @@ describe("Annotation: Coordinate", () => { it(`${rotation} degree rotation.`, (done) => { const src = path.join( __dirname, - `../TestMaterials/recipe/test-L-${rotation}.pdf` + `../TestMaterials/recipe/test-L-${rotation}.pdf`, ); const output = path.join( __dirname, - `../output/annotation-rotation-${rotation}.pdf` + `../output/annotation-rotation-${rotation}.pdf`, ); const recipe = new HummusRecipe(src, output); recipe diff --git a/tests/recipe/annotation-text.js b/tests/recipe/annotation-text.js index 8994a7c5..c861993b 100644 --- a/tests/recipe/annotation-text.js +++ b/tests/recipe/annotation-text.js @@ -48,7 +48,7 @@ describe("Annotation: Text Annotations", () => { color: [100, 0, 255], text: "Squiggly!", }, - } + }, ) .text("This text should be striked out with custom value.", 50, 350, { strikeOut: { @@ -73,7 +73,7 @@ describe("Annotation: Text Annotations", () => { it("Add a highlight with text box.", (done) => { const output = path.join( __dirname, - "../output/annotation-with-textbox.pdf" + "../output/annotation-with-textbox.pdf", ); const recipe = new HummusRecipe("new", output); const textContent = @@ -251,7 +251,7 @@ describe("Annotation: Text Annotations", () => { title: "Richard Stallman", date: "2023-07-13T08:39:21.090Z", subject: "A subject 25", - } + }, ) .text("This text should be striked out with custom value.", 50, 350, { strikeOut: { @@ -277,7 +277,7 @@ describe("Annotation: Text Annotations", () => { size: 25, title: "Evan You", subject: "A subject 27", - } + }, ) .annot(50, 500, "Text", { text: richText, diff --git a/tests/recipe/appendPages.js b/tests/recipe/appendPages.js index ae1d285a..f4c2b73b 100644 --- a/tests/recipe/appendPages.js +++ b/tests/recipe/appendPages.js @@ -7,7 +7,7 @@ describe("Append Pages", () => { const src = path.join(__dirname, "../TestMaterials/recipe/test.pdf"); const longPDF = path.join( __dirname, - "../TestMaterials/recipe/compressed.tracemonkey-pldi-09.pdf" + "../TestMaterials/recipe/compressed.tracemonkey-pldi-09.pdf", ); const output = path.join(__dirname, `../output/${taskAP}.pdf`); const recipe = new HummusRecipe(src, output); diff --git a/tests/recipe/arcs.js b/tests/recipe/arcs.js index cacc18a1..bbfdf1db 100644 --- a/tests/recipe/arcs.js +++ b/tests/recipe/arcs.js @@ -111,7 +111,7 @@ function pie(x, y, radius, chart) { radius, startAt, endAt, - Object.assign({}, options, sectorOpts) + Object.assign({}, options, sectorOpts), ); // Implant percentages inside sectors where possible @@ -243,7 +243,7 @@ describe("Arc test", () => { "sector: true\ncloses arc\nto centerpoint", x + 215, y + r + 21, - txtOps + txtOps, ) .arc(x + 360, y, r, 45, -270, { rotation: 0, fill: "def", sector: true }) .arc(x + 363, y + 7, r, 45, 90, { diff --git a/tests/recipe/color.js b/tests/recipe/color.js index bbf2a1d5..16d67882 100644 --- a/tests/recipe/color.js +++ b/tests/recipe/color.js @@ -79,14 +79,14 @@ describe("Color", () => { [490, 100], [510, 100], ], - { stroke: [200, 0, 0], lineWidth: 5 } + { stroke: [200, 0, 0], lineWidth: 5 }, ) .line( [ [500, 90], [500, 110], ], - { stroke: [200, 0, 0], lineWidth: 5 } + { stroke: [200, 0, 0], lineWidth: 5 }, ) .text("3 corner yellow polygon, outline red", 360, 630) .polygon( @@ -95,7 +95,7 @@ describe("Color", () => { [550, 600], [450, 600], ], - { fill: [255, 255, 0], stroke: [255, 0, 0] } + { fill: [255, 255, 0], stroke: [255, 0, 0] }, ) .text("ellipse with red dash border, violet fill", 40, 675) .ellipse(150, 625, 75, 25, { @@ -147,14 +147,14 @@ describe("Color", () => { [490, 100], [510, 100], ], - { stroke: [255, 0, 255, 0], lineWidth: 5 } + { stroke: [255, 0, 255, 0], lineWidth: 5 }, ) .line( [ [500, 90], [500, 110], ], - { stroke: [255, 0, 255, 0], lineWidth: 5 } + { stroke: [255, 0, 255, 0], lineWidth: 5 }, ) .text("3 corner yellow polygon, outline black", 360, 630) .polygon( @@ -163,7 +163,7 @@ describe("Color", () => { [550, 600], [450, 600], ], - { fill: [0, 0, 255, 0], stroke: [0, 0, 0, 255] } + { fill: [0, 0, 255, 0], stroke: [0, 0, 0, 255] }, ) .text("ellipse with cyan dash border, pale green fill", 40, 675) .ellipse(150, 625, 75, 25, { @@ -216,14 +216,14 @@ describe("Color", () => { [490, 100], [510, 100], ], - { stroke: [255], lineWidth: 5 } + { stroke: [255], lineWidth: 5 }, ) .line( [ [500, 90], [500, 110], ], - { stroke: [255], lineWidth: 5 } + { stroke: [255], lineWidth: 5 }, ) .text("3 corner gray polygon, outline black", 360, 630, { color: [0] }) .polygon( @@ -232,7 +232,7 @@ describe("Color", () => { [550, 600], [450, 600], ], - { fill: [235], stroke: [0] } + { fill: [235], stroke: [0] }, ) .text("ellipse with black dash border, gray fill", 40, 675, { color: [0], @@ -291,7 +291,7 @@ describe("Color", () => { .text( "IMPLICIT Colorspace (via input color specification)", col, - line(++i) + line(++i), ) .text("Gray, DecimalColor: [200]", para, line(++i), { color: [200] }) @@ -344,66 +344,66 @@ describe("Color", () => { " --------------------------------------------------------------------", para, line(++i), - { font: font, size: 12 } + { font: font, size: 12 }, ) .text( "| Color | HexColor | DecimalColor | PercentColor |", para, line(++i), - { font: font, size: 12 } + { font: font, size: 12 }, ) .text( "| Space | (string) | (array) | (string) |", para, line(++i), - { font: font, size: 12 } + { font: font, size: 12 }, ) .text( "|-------+------------+--------------------------------+--------------|", para, line(++i), - { font: font, size: 12 } + { font: font, size: 12 }, ) .text( "| Gray | #GG | [gray] | %G |", para, line(++i), - { font: font, size: 12 } + { font: font, size: 12 }, ) .text( "| RGB | #rrggbb | [red, green, blue] | %r,g,b |", para, line(++i), - { font: font, size: 12 } + { font: font, size: 12 }, ) .text( "| CMYK | #ccmmyykk | [cyan, magenta, yellow, black] | %c,m,y,k |", para, line(++i), - { font: font, size: 12 } + { font: font, size: 12 }, ) .text( " --------------------------------------------------------------------", para, line(++i), - { font: font, size: 12 } + { font: font, size: 12 }, ); i += 1; recipe .text( "HexColor component values (two hex digits) range from 00 to FF.", para, - line(++i) + line(++i), ) .text( "DecimalColor component values range from 0 to 255.", para, - line(++i) + line(++i), ) .text( "PercentColor component values range from 0 to 100.", para, - line(++i) + line(++i), ) // testing simple drawing of shapes with no color specifications. diff --git a/tests/recipe/coloring.js b/tests/recipe/coloring.js index 7b85405f..878bbc81 100644 --- a/tests/recipe/coloring.js +++ b/tests/recipe/coloring.js @@ -21,7 +21,7 @@ describe("Coloring", () => { [80, 430], [100, 430], ], - { lineWidth: 0.5 } + { lineWidth: 0.5 }, ) .endPage() .endPDF(done); @@ -31,7 +31,7 @@ describe("Coloring", () => { const output = path.join(__dirname, "../output/color-special.pdf"); const rgbColors = path.join( __dirname, - "../TestMaterials/recipe/rgb-colors.json" + "../TestMaterials/recipe/rgb-colors.json", ); const lineOpt = { lineWidth: 0.5 }; const recipe = new HummusRecipe(output, output, { @@ -55,7 +55,7 @@ describe("Coloring", () => { [80, 70], [100, 70], ], - lineOpt + lineOpt, ) .text("Purple", 100, 100, { bold: true, size: 20, color: "purple" }) .line( @@ -63,7 +63,7 @@ describe("Coloring", () => { [80, 100], [100, 100], ], - lineOpt + lineOpt, ) .text("Yellow", 100, 130, { bold: true, size: 20, color: "yellow" }) .line( @@ -71,7 +71,7 @@ describe("Coloring", () => { [80, 130], [100, 130], ], - lineOpt + lineOpt, ) .text("Fucia", 100, 160, { bold: true, size: 20, color: "fucia" }) .line( @@ -79,7 +79,7 @@ describe("Coloring", () => { [80, 160], [100, 160], ], - lineOpt + lineOpt, ) .text("Magenta", 100, 190, { bold: true, @@ -92,7 +92,7 @@ describe("Coloring", () => { [80, 190], [100, 190], ], - lineOpt + lineOpt, ) .text("Defining Gold Here", 100, 220, { bold: true, @@ -105,7 +105,7 @@ describe("Coloring", () => { [80, 220], [100, 220], ], - lineOpt + lineOpt, ) .text("Using Gold Here", 100, 250, { bold: true, @@ -117,7 +117,7 @@ describe("Coloring", () => { [80, 250], [100, 250], ], - lineOpt + lineOpt, ) .text("Undefined color returns default color", 100, 280, { bold: true, @@ -129,7 +129,7 @@ describe("Coloring", () => { [80, 280], [100, 280], ], - lineOpt + lineOpt, ) .chroma("!load", rgbColors) .text("Burlywood from file load", 100, 310, { @@ -142,7 +142,7 @@ describe("Coloring", () => { [80, 310], [100, 310], ], - lineOpt + lineOpt, ) .endPage() .endPDF(done); @@ -167,7 +167,7 @@ describe("Coloring", () => { [80, 460], [100, 460], ], - lineOpt + lineOpt, ) .text("Separation color orange", 100, 490, { bold: true, @@ -180,7 +180,7 @@ describe("Coloring", () => { [80, 490], [100, 490], ], - lineOpt + lineOpt, ) .text("Pantone 1505 C, RGB", 100, 520, { bold: true, @@ -193,7 +193,7 @@ describe("Coloring", () => { [80, 520], [100, 520], ], - lineOpt + lineOpt, ) .text("Pantone 1505 C, CMYK", 100, 550, { bold: true, @@ -206,7 +206,7 @@ describe("Coloring", () => { [80, 550], [100, 550], ], - lineOpt + lineOpt, ) .text("CMYK Direct", 100, 580, { bold: true, @@ -219,7 +219,7 @@ describe("Coloring", () => { [80, 580], [100, 580], ], - lineOpt + lineOpt, ) .text("Nan, a great PDF collaborator!", 100, 360, { bold: true, diff --git a/tests/recipe/create.js b/tests/recipe/create.js index dd3183ee..c22769a2 100644 --- a/tests/recipe/create.js +++ b/tests/recipe/create.js @@ -43,7 +43,7 @@ describe("Create", () => { stroke: [0, 0, 140], fill: [153, 143, 32], opacity: 0.2, - } + }, ) .image(myCats, "center", 450, { width: 250, diff --git a/tests/recipe/createWithBuffer.js b/tests/recipe/createWithBuffer.js index 7ac7d36f..e6393a14 100644 --- a/tests/recipe/createWithBuffer.js +++ b/tests/recipe/createWithBuffer.js @@ -30,7 +30,7 @@ describe("Modify", () => { assert(outBuffer instanceof Buffer); fs.writeFileSync( path.join(__dirname, "../output/createWithBuffer.pdf"), - outBuffer + outBuffer, ); done(); }); @@ -40,7 +40,7 @@ describe("Modify", () => { const src = path.join(__dirname, "../TestMaterials/recipe/test.pdf"); const output = path.join( __dirname, - "../output/createWithBufferAndFileOutput.pdf" + "../output/createWithBufferAndFileOutput.pdf", ); const myCats = path.join(__dirname, "../TestMaterials/recipe/myCats.jpg"); const buffer = fs.readFileSync(src); diff --git a/tests/recipe/encryption.js b/tests/recipe/encryption.js index d2c1ad42..62ba7f9c 100644 --- a/tests/recipe/encryption.js +++ b/tests/recipe/encryption.js @@ -63,7 +63,7 @@ describe("Encryption", () => { .text( "When creating file, an empty viewing password (userPassword)", 150, - 300 + 300, ) .text("is required for file encryption to occur.", 150, 350) .endPage() @@ -82,7 +82,7 @@ describe("Encryption", () => { .text( "When creating file, an empty viewing password (userPassword)", 150, - 300 + 300, ) .text("is required for file encryption to occur.", 150, 350) .endPage() diff --git a/tests/recipe/font.js b/tests/recipe/font.js index c57a00a0..295e1ec2 100644 --- a/tests/recipe/font.js +++ b/tests/recipe/font.js @@ -9,7 +9,7 @@ describe("Font", () => { it("Add text with custom fonts", (done) => { const output = path.join( __dirname, - "../output/Add text with custom fonts.pdf" + "../output/Add text with custom fonts.pdf", ); const recipe = new HummusRecipe("new", output, { fontSrcPath: path.join(__dirname, "../output/recipe/fonts"), diff --git a/tests/recipe/htmlToTextObjects.js b/tests/recipe/htmlToTextObjects.js index aea99b6d..164d33d6 100644 --- a/tests/recipe/htmlToTextObjects.js +++ b/tests/recipe/htmlToTextObjects.js @@ -4,7 +4,7 @@ const assert = require("chai").assert; const { htmlToTextObjects } = require("../../lib/recipe/htmlToTextObjects"); const htmlCodes = fs.readFileSync( path.join(__dirname, "../TestMaterials/recipe/text.html"), - "utf8" + "utf8", ); describe("HTML to TextObjects", () => { it("parse HTML", (done) => { diff --git a/tests/recipe/info.js b/tests/recipe/info.js index a5c8e96f..e8fb503d 100644 --- a/tests/recipe/info.js +++ b/tests/recipe/info.js @@ -31,7 +31,7 @@ describe("Modify", () => { const src = path.join(__dirname, "../TestMaterials/recipe/test-info.pdf"); const output = path.join( __dirname, - "../output/change info with IndirectObjectReference.pdf" + "../output/change info with IndirectObjectReference.pdf", ); const recipe = new HummusRecipe(src, output); recipe diff --git a/tests/recipe/insertPage.js b/tests/recipe/insertPage.js index 63cc8c4b..53321cbe 100644 --- a/tests/recipe/insertPage.js +++ b/tests/recipe/insertPage.js @@ -8,11 +8,11 @@ describe("Insert Pages", () => { const src = path.join(__dirname, "../TestMaterials/recipe/test.pdf"); const longPDF = path.join( __dirname, - "../TestMaterials/recipe/compressed.tracemonkey-pldi-09.pdf" + "../TestMaterials/recipe/compressed.tracemonkey-pldi-09.pdf", ); const output = path.join( __dirname, - "../output/Insert page from other pdf.pdf" + "../output/Insert page from other pdf.pdf", ); const recipe = new HummusRecipe(src, output); recipe @@ -28,12 +28,12 @@ describe("Insert Pages", () => { it("Insert page from other pdf (revert)", (done) => { const primary = path.join( __dirname, - "../TestMaterials/recipe/compressed.tracemonkey-pldi-09.pdf" + "../TestMaterials/recipe/compressed.tracemonkey-pldi-09.pdf", ); const insertSrc = path.join(__dirname, "../TestMaterials/recipe/test.pdf"); const output = path.join( __dirname, - "../output/Insert page from other pdf (revert).pdf" + "../output/Insert page from other pdf (revert).pdf", ); const recipe = new HummusRecipe(primary, output); for (let page = 1; page <= 14; page++) { diff --git a/tests/recipe/layout.js b/tests/recipe/layout.js index eff75ad4..cbf72e1f 100644 --- a/tests/recipe/layout.js +++ b/tests/recipe/layout.js @@ -218,7 +218,7 @@ to lists, requires prior specific permission and/or a fee."; }) .text( "D.3.4 [Programming Languages]: Processors — Incremental compilers, code generation.", - { bold: false } + { bold: false }, ) .movedown(1.5) .text("General Terms ", { bold: true, italic: true }) diff --git a/tests/recipe/modify-in-place.js b/tests/recipe/modify-in-place.js index eccdb8ea..bf1de292 100644 --- a/tests/recipe/modify-in-place.js +++ b/tests/recipe/modify-in-place.js @@ -7,7 +7,7 @@ describe("Modify in Place", () => { const src = path.join(__dirname, "../TestMaterials/recipe/test.pdf"); const output = path.join( __dirname, - "../output/Add something to an existing and overwrite it.pdf" + "../output/Add something to an existing and overwrite it.pdf", ); const rs = fs.createReadStream(src); const cp = fs.createWriteStream(output); diff --git a/tests/recipe/modify.js b/tests/recipe/modify.js index ec9d7d0b..ff525171 100644 --- a/tests/recipe/modify.js +++ b/tests/recipe/modify.js @@ -6,7 +6,7 @@ describe("Modify", () => { const src = path.join(__dirname, "../TestMaterials/recipe/test.pdf"); const output = path.join( __dirname, - "../output/Add something to an existing.pdf" + "../output/Add something to an existing.pdf", ); const recipe = new HummusRecipe(src, output); recipe @@ -40,7 +40,7 @@ describe("Modify", () => { const src = path.join(__dirname, "../TestMaterials/recipe/test2.pdf"); const output = path.join( __dirname, - "../output/Add something to an existing (with annots).pdf" + "../output/Add something to an existing (with annots).pdf", ); const recipe = new HummusRecipe(src, output); recipe diff --git a/tests/recipe/overlay.js b/tests/recipe/overlay.js index 1706ab6a..6c5cb0b1 100644 --- a/tests/recipe/overlay.js +++ b/tests/recipe/overlay.js @@ -6,7 +6,7 @@ describe("Modify", () => { const src = path.join(__dirname, "../TestMaterials/recipe/test2.pdf"); const overlayPDF = path.join( __dirname, - "../TestMaterials/recipe/test3.pdf" + "../TestMaterials/recipe/test3.pdf", ); const output = path.join(__dirname, "../output/Add overlay.pdf"); @@ -17,15 +17,15 @@ describe("Modify", () => { it("Add Overlay from other PDF - position", (done) => { const src = path.join( __dirname, - "../TestMaterials/recipe/issue-28-input.pdf" + "../TestMaterials/recipe/issue-28-input.pdf", ); const overlayPDF = path.join( __dirname, - "../TestMaterials/recipe/test2.pdf" + "../TestMaterials/recipe/test2.pdf", ); const output = path.join( __dirname, - "../output/Add overlay (#28) - position.pdf" + "../output/Add overlay (#28) - position.pdf", ); const recipe = new HummusRecipe(src, output); @@ -40,15 +40,15 @@ describe("Modify", () => { it("Add Overlay from other PDF - scale", (done) => { const src = path.join( __dirname, - "../TestMaterials/recipe/issue-28-input.pdf" + "../TestMaterials/recipe/issue-28-input.pdf", ); const overlayPDF = path.join( __dirname, - "../TestMaterials/recipe/test2.pdf" + "../TestMaterials/recipe/test2.pdf", ); const output = path.join( __dirname, - "../output/Add overlay (#28) - scale.pdf" + "../output/Add overlay (#28) - scale.pdf", ); const recipe = new HummusRecipe(src, output); @@ -62,15 +62,15 @@ describe("Modify", () => { it("Add Overlay from other PDF - fitWidth", (done) => { const src = path.join( __dirname, - "../TestMaterials/recipe/issue-28-input.pdf" + "../TestMaterials/recipe/issue-28-input.pdf", ); const overlayPDF = path.join( __dirname, - "../TestMaterials/recipe/test2.pdf" + "../TestMaterials/recipe/test2.pdf", ); const output = path.join( __dirname, - "../output/Add overlay (#28) - fitWidth.pdf" + "../output/Add overlay (#28) - fitWidth.pdf", ); const recipe = new HummusRecipe(src, output); @@ -84,15 +84,15 @@ describe("Modify", () => { it("Add Overlay from other PDF - fitHeight", (done) => { const src = path.join( __dirname, - "../TestMaterials/recipe/issue-28-input.pdf" + "../TestMaterials/recipe/issue-28-input.pdf", ); const overlayPDF = path.join( __dirname, - "../TestMaterials/recipe/test2.pdf" + "../TestMaterials/recipe/test2.pdf", ); const output = path.join( __dirname, - "../output/Add overlay (#28) - fitHeight.pdf" + "../output/Add overlay (#28) - fitHeight.pdf", ); const recipe = new HummusRecipe(src, output); @@ -106,15 +106,15 @@ describe("Modify", () => { it("Add Overlay from other PDF - stretch to fit", (done) => { const src = path.join( __dirname, - "../TestMaterials/recipe/issue-28-input.pdf" + "../TestMaterials/recipe/issue-28-input.pdf", ); const overlayPDF = path.join( __dirname, - "../TestMaterials/recipe/test2.pdf" + "../TestMaterials/recipe/test2.pdf", ); const output = path.join( __dirname, - "../output/Add overlay (#28) - stretch.pdf" + "../output/Add overlay (#28) - stretch.pdf", ); const recipe = new HummusRecipe(src, output); @@ -129,7 +129,7 @@ describe("Modify", () => { const src = path.join(__dirname, "../TestMaterials/recipe/test2.pdf"); const overlayPDF = path.join( __dirname, - "../TestMaterials/recipe/test3.pdf" + "../TestMaterials/recipe/test3.pdf", ); const output = path.join(__dirname, "../output/Add overlay with page.pdf"); @@ -140,15 +140,15 @@ describe("Modify", () => { it("Add Overlay from other PDF - position w/ page_index", (done) => { const src = path.join( __dirname, - "../TestMaterials/recipe/issue-28-input.pdf" + "../TestMaterials/recipe/issue-28-input.pdf", ); const overlayPDF = path.join( __dirname, - "../TestMaterials/recipe/test2.pdf" + "../TestMaterials/recipe/test2.pdf", ); const output = path.join( __dirname, - "../output/Add overlay (#28) with page - position.pdf" + "../output/Add overlay (#28) with page - position.pdf", ); const recipe = new HummusRecipe(src, output); @@ -163,15 +163,15 @@ describe("Modify", () => { it("Add Overlay from other PDF - scale w/ page_index", (done) => { const src = path.join( __dirname, - "../TestMaterials/recipe/issue-28-input.pdf" + "../TestMaterials/recipe/issue-28-input.pdf", ); const overlayPDF = path.join( __dirname, - "../TestMaterials/recipe/test2.pdf" + "../TestMaterials/recipe/test2.pdf", ); const output = path.join( __dirname, - "../output/Add overlay (#28) with page - scale.pdf" + "../output/Add overlay (#28) with page - scale.pdf", ); const recipe = new HummusRecipe(src, output); @@ -186,15 +186,15 @@ describe("Modify", () => { it("Add Overlay from other PDF - fitWidth w/ page_index", (done) => { const src = path.join( __dirname, - "../TestMaterials/recipe/issue-28-input.pdf" + "../TestMaterials/recipe/issue-28-input.pdf", ); const overlayPDF = path.join( __dirname, - "../TestMaterials/recipe/test2.pdf" + "../TestMaterials/recipe/test2.pdf", ); const output = path.join( __dirname, - "../output/Add overlay (#28) with page - fitWidth.pdf" + "../output/Add overlay (#28) with page - fitWidth.pdf", ); const recipe = new HummusRecipe(src, output); @@ -209,15 +209,15 @@ describe("Modify", () => { it("Add Overlay from other PDF - fitHeight w/ page_index", (done) => { const src = path.join( __dirname, - "../TestMaterials/recipe/issue-28-input.pdf" + "../TestMaterials/recipe/issue-28-input.pdf", ); const overlayPDF = path.join( __dirname, - "../TestMaterials/recipe/test2.pdf" + "../TestMaterials/recipe/test2.pdf", ); const output = path.join( __dirname, - "../output/Add overlay (#28) with page - fitHeight.pdf" + "../output/Add overlay (#28) with page - fitHeight.pdf", ); const recipe = new HummusRecipe(src, output); @@ -232,15 +232,15 @@ describe("Modify", () => { it("Add Overlay from other PDF - stretch to fit w/ page_index", (done) => { const src = path.join( __dirname, - "../TestMaterials/recipe/issue-28-input.pdf" + "../TestMaterials/recipe/issue-28-input.pdf", ); const overlayPDF = path.join( __dirname, - "../TestMaterials/recipe/test2.pdf" + "../TestMaterials/recipe/test2.pdf", ); const output = path.join( __dirname, - "../output/Add overlay (#28) with page - stretch.pdf" + "../output/Add overlay (#28) with page - stretch.pdf", ); const recipe = new HummusRecipe(src, output); diff --git a/tests/recipe/positioning.js b/tests/recipe/positioning.js index 4699c28c..5907cbf7 100644 --- a/tests/recipe/positioning.js +++ b/tests/recipe/positioning.js @@ -11,28 +11,28 @@ function frame(recipe, left, top, width, height) { [left - cut, top], [right + cut, top], ], - options + options, ); // top recipe.line( [ [left - cut, bottom], [right + cut, bottom], ], - options + options, ); // bottom recipe.line( [ [left, top - cut], [left, bottom + cut], ], - options + options, ); // left recipe.line( [ [right, top - cut], [right, bottom + cut], ], - options + options, ); // right } @@ -101,28 +101,28 @@ describe("Graphic Object Positioning", () => { [col[1], row[4]], [col[1] + wid[0], row[4] + hgt[0]], ], - { width: 1 } + { width: 1 }, ) .line( [ [col[2], row[4]], [col[2] + wid[0], row[4] + hgt[0]], ], - { width: 2 } + { width: 2 }, ) .line( [ [col[3], row[4]], [col[3] + wid[0], row[4] + hgt[0]], ], - { width: 3 } + { width: 3 }, ) .line( [ [col[4], row[4]], [col[4] + wid[0], row[4] + hgt[0]], ], - { width: 5 } + { width: 5 }, ) .ellipse( @@ -130,20 +130,20 @@ describe("Graphic Object Positioning", () => { row[5] + hgt[0] / 2, wid[1] / 2, hgt[0] / 2, - { width: 1 } + { width: 1 }, ) .ellipse( col[3] + wid[1] / 2, row[5] + hgt[0] / 2, wid[1] / 2, hgt[0] / 2, - { width: 5 } + { width: 5 }, ) .text( "Note, object growth outside cut frames with increasing line widths", 100, - 40 + 40, ) .text("*", 80, 40, { color: "ff0000", fontSize: 32 }) @@ -266,14 +266,14 @@ describe("Graphic Object Positioning", () => { row[3] + hgt[0] / 2, wid[1] / 2, hgt[0] / 2, - { width: 1, rotation: 10, stroke: defOrigColor } + { width: 1, rotation: 10, stroke: defOrigColor }, ) .ellipse( col[3] + wid[1] / 2, row[3] + hgt[0] / 2, wid[1] / 2, hgt[0] / 2, - { width: 1, rotation: 10, rotationOrigin: [lft(col[3]), btm(row[3])] } + { width: 1, rotation: 10, rotationOrigin: [lft(col[3]), btm(row[3])] }, ) .ellipse( col[1] + wid[1] / 2, @@ -284,14 +284,14 @@ describe("Graphic Object Positioning", () => { width: 1, rotation: 10, rotationOrigin: [rht(col[1], wid[1]), top(row[4])], - } + }, ) .ellipse( col[3] + wid[1] / 2, row[4] + hgt[0] / 2, wid[1] / 2, hgt[0] / 2, - { width: 1, rotation: 10, rotationOrigin: [lft(col[3]), top(row[4])] } + { width: 1, rotation: 10, rotationOrigin: [lft(col[3]), top(row[4])] }, ) .ellipse( col[1] + wid[1] / 2, @@ -302,7 +302,7 @@ describe("Graphic Object Positioning", () => { width: 1, rotation: 10, rotationOrigin: [rht(col[1], wid[1]), btm(row[5])], - } + }, ); markOrigin(recipe, col[1] + wid[1] / 2, row[3] + hgt[0] / 2); diff --git a/tests/recipe/rotation.js b/tests/recipe/rotation.js index abdf22e3..79c427d3 100644 --- a/tests/recipe/rotation.js +++ b/tests/recipe/rotation.js @@ -40,7 +40,7 @@ describe("Rotation", () => { it(pdf.title, (done) => { const src = path.join( __dirname, - `../TestMaterials/recipe/${pdf.filename}` + `../TestMaterials/recipe/${pdf.filename}`, ); const output = path.join(__dirname, `../output/${pdf.filename}`); const recipe = new HummusRecipe(src, output); diff --git a/tests/recipe/shapes.js b/tests/recipe/shapes.js index 874ba567..7e71b02d 100644 --- a/tests/recipe/shapes.js +++ b/tests/recipe/shapes.js @@ -75,28 +75,28 @@ describe("Regular Polygons, Stars, Arrows", () => { [cx - sl + 5, cy], [cx, cy], ], - { color: "red", width: 1, dash: [10, 3] } + { color: "red", width: 1, dash: [10, 3] }, ) .line( [ [cx, cy - sw / 2], [cx, cy + sw / 2], ], - { color: "red", width: 1, dash: [10, 3] } + { color: "red", width: 1, dash: [10, 3] }, ) .line( [ [cx - 5, cy], [cx + 5, cy], ], - { width: 1.5, lineCap: "butt", color: "#000000" } + { width: 1.5, lineCap: "butt", color: "#000000" }, ) .line( [ [cx, cy - 5], [cx, cy + 5], ], - { width: 1.5, lineCap: "butt", color: "#000000" } + { width: 1.5, lineCap: "butt", color: "#000000" }, ) .text("shaft", cx - 60, cy - sw / 2 - 15, { color: "#ff00ff" }) .text("arrowhead", cx + 15, cy - 5) @@ -108,7 +108,7 @@ describe("Regular Polygons, Stars, Arrows", () => { [cx - 125, cy + 50], [cx - 120, cy + 50], ], - { width: 0.5, lineCap: "butt", color: "#ff00ff" } + { width: 0.5, lineCap: "butt", color: "#ff00ff" }, ) .line( @@ -118,14 +118,14 @@ describe("Regular Polygons, Stars, Arrows", () => { [cx - 130, cy + sw], [cx - 120, cy + sw], ], - { width: 0.5, lineCap: "butt" } + { width: 0.5, lineCap: "butt" }, ) .line( [ [cx - 115, cy - sw], [cx - 5, cy - sw], ], - { width: 0.5, lineCap: "butt", dash: [4], dashPhase: 6 } + { width: 0.5, lineCap: "butt", dash: [4], dashPhase: 6 }, ) // length description @@ -137,7 +137,7 @@ describe("Regular Polygons, Stars, Arrows", () => { [cx, cy + sw + 20], [cx, cy + sw + 10], ], - { width: 0.5, lineCap: "butt", color: "#ff00ff" } + { width: 0.5, lineCap: "butt", color: "#ff00ff" }, ) .line( [ @@ -145,7 +145,7 @@ describe("Regular Polygons, Stars, Arrows", () => { [cx + sl, cy + sw + 20], [cx + sl, cy + sw + 10], ], - { width: 0.5, lineCap: "butt" } + { width: 0.5, lineCap: "butt" }, ) // tail marker @@ -154,7 +154,7 @@ describe("Regular Polygons, Stars, Arrows", () => { [cx - sw, cy - 5], [cx - sw, cy + 5], ], - { width: 2, lineCap: "butt", color: "#ffffff" } + { width: 2, lineCap: "butt", color: "#ffffff" }, ) .circle(cx - sw, cy, 3, { color: "red" }) .arrow(cx - sw - 4, cy + 5, { @@ -189,43 +189,43 @@ describe("Regular Polygons, Stars, Arrows", () => { "{number} x - x coordinate at center of the arrow which is also its rotation point", ux + 10, uh + 15, - uop + uop, ) .text( "{number} y - y coordinate at center of the arrow which is also its rotation point", ux + 10, uh + 30, - uop + uop, ) .text( "{number|number[ ]} [options.head=[10,10,0] - length, width and baseoffset of head of arrow.", ux + 10, uh + 45, - uop + uop, ) .text( "{number|number[ ]} [options.shaft=10] - length & width of shaft of arrow.", ux + 10, uh + 60, - uop + uop, ) .text( '{string} [options.at] - position and/or rotate at "head" or "tail" of arrow', ux + 10, uh + 75, - uop + uop, ) .text( "{boolean} [options.double=false] - indicate double headed arrow production", ux + 10, uh + 90, - uop + uop, ) .text( "Note that the circumscribed circle is for illustrative purposes and only naturally occurs when the shaft length is equal to arrowhead length, which is a property of the default arrow.", ux + 100, uh + 115, - { color: "#961d17", textBox: { width: 300, textAlign: "justify" } } + { color: "#961d17", textBox: { width: 300, textAlign: "justify" } }, ) // Examples @@ -353,20 +353,20 @@ describe("Regular Polygons, Stars, Arrows", () => { [x - 50, y - 3], [x - 50, y - 16], ], - { width: 0.3, color: "red" } + { width: 0.3, color: "red" }, ) .line( [ [x + 50, y - 3], [x + 50, y - 16], ], - { width: 0.3, color: "red" } + { width: 0.3, color: "red" }, ) .text( "center differs between single & double headed arrows", 50, y - 60, - { size: 9, textBox: { width: 100, textAlign: "center" } } + { size: 9, textBox: { width: 100, textAlign: "center" } }, ); x = 306; diff --git a/tests/recipe/split.js b/tests/recipe/split.js index 981a5d25..beee2916 100644 --- a/tests/recipe/split.js +++ b/tests/recipe/split.js @@ -7,11 +7,11 @@ describe("Split", () => { const outputDir = path.join(__dirname, "../output/"); const originalSrc = path.join( __dirname, - "../TestMaterials/recipe/compressed.tracemonkey-pldi-09.pdf" + "../TestMaterials/recipe/compressed.tracemonkey-pldi-09.pdf", ); const src = path.join( outputDir, - "split.compressed.tracemonkey-pldi-09.pdf" + "split.compressed.tracemonkey-pldi-09.pdf", ); fs.copyFileSync(originalSrc, src); const recipe = new HummusRecipe(src); diff --git a/tests/recipe/table.js b/tests/recipe/table.js index 2cc33973..37ff2187 100644 --- a/tests/recipe/table.js +++ b/tests/recipe/table.js @@ -168,7 +168,7 @@ describe("Text - Columns", () => { 'Tables showing new position when "overflow" encountered.', 80, y + 200, - { color: "#000000" } + { color: "#000000" }, ) .text("Note data driven property (color) assignment", 130, y + 220, { size: 12, @@ -188,7 +188,7 @@ describe("Text - Columns", () => { "Table continued onto subsequent pages (overflow encountered)", x, y - 30, - { color: "#000000" } + { color: "#000000" }, ) .table(x - 20, y, people.sort(compare), { columns: pcols, diff --git a/tests/recipe/text-centering.js b/tests/recipe/text-centering.js index 80a75c92..0bcac017 100644 --- a/tests/recipe/text-centering.js +++ b/tests/recipe/text-centering.js @@ -89,7 +89,7 @@ describe("Text - Centering", () => { .text( "<-- Text with line height applied\n (1.16% font size).", 340, - 490 + 490, ) .text("A\nAAA\nOOO\nVVV\n|", 30, 400, { color: "#000000", @@ -113,7 +113,7 @@ describe("Text - Centering", () => { [180, 25], [180, 425], ], - { stroke: "#ff00ff", lineWidth: 0.5 } + { stroke: "#ff00ff", lineWidth: 0.5 }, ); let x = 450; @@ -168,7 +168,7 @@ describe("Text - Centering", () => { [x - 5, y + p], [x + w + 5, y + p], ], - { lineWidth: 0.5, stroke: "red", lineCap: "butt" } + { lineWidth: 0.5, stroke: "red", lineCap: "butt" }, ) .circle(x, y, 2, { stroke: "red" }); @@ -193,7 +193,7 @@ describe("Text - Centering", () => { [x - 5, y + h], [x + w + 5, y + h], ], - { lineWidth: 0.5, stroke: "red", lineCap: "butt" } + { lineWidth: 0.5, stroke: "red", lineCap: "butt" }, ) .circle(x, y, 2, { stroke: "red" }); @@ -219,7 +219,7 @@ describe("Text - Centering", () => { [x + w - p, y - 5], [x + w - p, y + h + 5], ], - { lineWidth: 0.5, stroke: "red", lineCap: "butt" } + { lineWidth: 0.5, stroke: "red", lineCap: "butt" }, ) .circle(x, y, 2, { stroke: "red" }); @@ -244,7 +244,7 @@ describe("Text - Centering", () => { [x + p, y - 5], [x + p, y + h + 5], ], - { lineWidth: 0.5, stroke: "red", lineCap: "butt" } + { lineWidth: 0.5, stroke: "red", lineCap: "butt" }, ) .circle(x, y, 2, { stroke: "red" }); @@ -263,7 +263,7 @@ describe("Text - Centering", () => { lineWidth: 0.5, }, }, - } + }, ) .text( @@ -280,7 +280,7 @@ describe("Text - Centering", () => { lineWidth: 0.5, }, }, - } + }, ) .text( @@ -298,7 +298,7 @@ describe("Text - Centering", () => { lineWidth: 0.5, }, }, - } + }, ) .text( @@ -313,7 +313,7 @@ describe("Text - Centering", () => { height: 70, textAlign: "justify", }, - } + }, ); h = 70; @@ -333,7 +333,7 @@ describe("Text - Centering", () => { lineWidth: 0.5, }, }, - } + }, ) .circle(150, 625, 2, { stroke: "red" }) .circle(150, 625 + h, 2, { stroke: "red" }) @@ -352,7 +352,7 @@ describe("Text - Centering", () => { lineWidth: 0.5, }, }, - } + }, ) .text("text at\ncenter center", 265, 625, { color: "#000000", @@ -406,7 +406,7 @@ describe("Text - Centering", () => { lineWidth: 0.5, }, }, - } + }, ) .text("Using height and supplying textAlign: center center", 180, 725, { color: "#000000", @@ -448,7 +448,7 @@ describe("Text - Centering", () => { lineWidth: 0.5, }, }, - } + }, ); recipe.endPage(); diff --git a/tests/recipe/text-columns.js b/tests/recipe/text-columns.js index ca2194b1..3ddbc370 100644 --- a/tests/recipe/text-columns.js +++ b/tests/recipe/text-columns.js @@ -37,7 +37,7 @@ faucibus orci luctus et ultrices posuere cubilia Curae;"; 'Multiple columns with auto text fill using single "layout".', x, y - 20, - { color: "red" } + { color: "red" }, ) .layout(id, x, y, 500, 200, { columns: 3, gap: 10 }) .text(lorem, { diff --git a/tests/recipe/text-continued.js b/tests/recipe/text-continued.js index 928fb604..028de9cb 100644 --- a/tests/recipe/text-continued.js +++ b/tests/recipe/text-continued.js @@ -28,14 +28,14 @@ faucibus orci luctus et ultrices posuere cubilia Curae;"; [540, 10], [540, 300], ], - { lineWidth: 0.5 } + { lineWidth: 0.5 }, ) .line( [ [72, 72], [560, 72], ], - { lineWidth: 0.5 } + { lineWidth: 0.5 }, ) .text(lorem.slice(0, 500), { rotation: 0, @@ -49,7 +49,7 @@ faucibus orci luctus et ultrices posuere cubilia Curae;"; "Simple Text Flow, 3 segments, showing color change and hilite", x, y, - { color: "#000000" } + { color: "#000000" }, ); x = 72; @@ -70,15 +70,15 @@ faucibus orci luctus et ultrices posuere cubilia Curae;"; .text("Did a movedown(2) to get ", { color: "blue", hilite: true }) .text( 'text to this spot in box. Notice the text hiliting, which is different from "fill" for the text box. ', - { color: "green", size: 14 } + { color: "green", size: 14 }, ) .text( - "It can have different colors, with yellow being the default at opacity .5. See blue higlight below" + "It can have different colors, with yellow being the default at opacity .5. See blue higlight below", ) .movedown(2) .text( "Box was constructed with multiple text statements without specifying any x,y coordinates. ", - { color: "blue", hilite: { color: "#81e6ff" } } + { color: "blue", hilite: { color: "#81e6ff" } }, ) .movedown() .text("Notice, here is a change in font size. ", { diff --git a/tests/recipe/text.js b/tests/recipe/text.js index 4e7c4d5d..ddd18b2d 100644 --- a/tests/recipe/text.js +++ b/tests/recipe/text.js @@ -3,7 +3,7 @@ const path = require("path"); const HummusRecipe = require("../../lib").Recipe; const htmlCodes = fs.readFileSync( path.join(__dirname, "../TestMaterials/recipe/text.html"), - "utf8" + "utf8", ); describe("Text", () => { @@ -78,7 +78,7 @@ describe("Text", () => { font: "Roboto", size: 20, color: "#ff0000", - } + }, ) .endPage() .endPDF(done); @@ -88,7 +88,7 @@ describe("Text", () => { const src = "new"; //path.join(__dirname, '../TestMaterials/recipe/test.pdf'); const output = path.join( __dirname, - "../output/Add text with html codes.pdf" + "../output/Add text with html codes.pdf", ); const recipe = new HummusRecipe(src, output); recipe @@ -103,7 +103,7 @@ describe("Text", () => { it("Add text with html codes inside textbox", (done) => { const output = path.join( __dirname, - "../output/Add text with html codes inside textbox.pdf" + "../output/Add text with html codes inside textbox.pdf", ); const recipe = new HummusRecipe("new", output); recipe @@ -131,7 +131,7 @@ describe("Text", () => { const src = "new"; //path.join(__dirname, '../TestMaterials/recipe/test.pdf'); const output = path.join( __dirname, - "../output/Add text inside textbox.pdf" + "../output/Add text inside textbox.pdf", ); const recipe = new HummusRecipe(src, output); const textContent = diff --git a/tests/recipe/triangle.js b/tests/recipe/triangle.js index 25ce2409..fb16a91a 100644 --- a/tests/recipe/triangle.js +++ b/tests/recipe/triangle.js @@ -15,14 +15,14 @@ describe("Triangles", () => { [50, y], [550, y], ], - { color: "#aa", width: 0.5, opacity: 0.5 } + { color: "#aa", width: 0.5, opacity: 0.5 }, ) .line( [ [x, 50], [x, 700], ], - { color: "#aa", width: 0.5, opacity: 0.5 } + { color: "#aa", width: 0.5, opacity: 0.5 }, ) .triangle(x, y, [90, 60, 80], { width: 0.5, color: "blue", debug: true }) @@ -59,7 +59,7 @@ describe("Triangles", () => { [50, y], [550, y], ], - { color: "#aa", width: 0.5, opacity: 0.5 } + { color: "#aa", width: 0.5, opacity: 0.5 }, ) .triangle(x, y, sas, { traitID: "sas", @@ -102,7 +102,7 @@ describe("Triangles", () => { [50, y], [550, y], ], - { color: "#aa", width: 0.5, opacity: 0.5 } + { color: "#aa", width: 0.5, opacity: 0.5 }, ) .triangle(x, y, asa, { traitID: "asa", @@ -145,7 +145,7 @@ describe("Triangles", () => { [50, y], [550, y], ], - { color: "#aa", width: 0.5, opacity: 0.5 } + { color: "#aa", width: 0.5, opacity: 0.5 }, ) .triangle(x, y, [40, 40, 40], { traitID: "sas", @@ -203,7 +203,7 @@ describe("Triangles", () => { [50, y], [550, y], ], - { color: "#aa", width: 0.5, opacity: 0.5 } + { color: "#aa", width: 0.5, opacity: 0.5 }, ) .rectangle(x, y - 59, 51, 59, { width: 1, @@ -224,7 +224,7 @@ describe("Triangles", () => { "NOTE: When no position point specified\nrotation occurs around bounding box center,\nnot at the given x,y coordinate.", x + 80, y - 50, - { color: "red" } + { color: "red" }, ) .text("rotation: 15", x, y + 21, txtOps) .endPage() diff --git a/tests/recipe/vector.js b/tests/recipe/vector.js index f9b5a071..151d51fb 100644 --- a/tests/recipe/vector.js +++ b/tests/recipe/vector.js @@ -97,7 +97,7 @@ describe("Vector", () => { fill: "#000000", stroke: "#00ff00", opacity: 0.2, - } + }, ) .polygon( [ @@ -109,7 +109,7 @@ describe("Vector", () => { fill: "#ff0000", stroke: "#ff0000", opacity: 0.5, - } + }, ) .polygon( [ @@ -122,7 +122,7 @@ describe("Vector", () => { stroke: "#033002", opacity: 0.35, dash: [12, 12], - } + }, ) .polygon( [ @@ -134,7 +134,7 @@ describe("Vector", () => { fill: "#0000ff", stroke: "#0000ff", opacity: 0, - } + }, ) .polygon( [ @@ -145,7 +145,7 @@ describe("Vector", () => { { stroke: "#ff0000", skewY: 20, - } + }, ) .polygon( [ @@ -160,7 +160,7 @@ describe("Vector", () => { fill: "#0000ff", stroke: "#0000ff", opacity: 0.75, - } + }, ) .line( [ @@ -174,7 +174,7 @@ describe("Vector", () => { { lineWidth: 10, dash: [0, 0], - } + }, ); let x = 175; let y = 11; @@ -186,7 +186,7 @@ describe("Vector", () => { [x, y], [x + 20, y], ], - { lineWidth: 10, lineCap: "butt" } + { lineWidth: 10, lineCap: "butt" }, ) .text("butt", x + 30, 5, { color: "red" }) .line( @@ -194,7 +194,7 @@ describe("Vector", () => { [x, y + 20], [x + 20, y + 20], ], - { lineWidth: 10, lineCap: "round" } + { lineWidth: 10, lineCap: "round" }, ) // default .text("round", x + 30, 5 + h, { color: "green" }) .line( @@ -202,7 +202,7 @@ describe("Vector", () => { [x, y + 40], [x + 20, y + 40], ], - { lineWidth: 10, lineCap: "square" } + { lineWidth: 10, lineCap: "square" }, ) .text("square", x + 30, 5 + 2 * h, { color: "red" }); @@ -215,7 +215,7 @@ describe("Vector", () => { [x + 20, y + 30], [x, y + 50], ], - { lineWidth: 8, lineJoin: "miter", miterLimit: 3 } + { lineWidth: 8, lineJoin: "miter", miterLimit: 3 }, ) .text("miter", x - 3, 70, { rotation: -45, color: "red" }) .polygon( @@ -224,7 +224,7 @@ describe("Vector", () => { [x + 60, y + 30], [x + 40, y + 50], ], - { lineWidth: 8, lineJoin: "round" } + { lineWidth: 8, lineJoin: "round" }, ) // default .text("round", x + 37, 70, { rotation: -45, color: "green" }) .polygon( @@ -233,7 +233,7 @@ describe("Vector", () => { [x + 100, y + 30], [x + 80, y + 50], ], - { lineWidth: 8, lineJoin: "bevel" } + { lineWidth: 8, lineJoin: "bevel" }, ) .text("bevel", x + 77, 70, { rotation: -45, color: "red" }) .text(":lineJoins", 415, 33)