forked from foliojs/pdfkit
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor on equality check function (foliojs#1280)
Avoidable 'if' statement
- Loading branch information
1 parent
3f69586
commit 4a24d10
Showing
6 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
var PDFDocument = require('../'); | ||
|
||
var fs = require('fs'); | ||
|
||
// Create a new PDFDocument | ||
var doc = new PDFDocument(); | ||
|
||
doc.pipe(fs.createWriteStream('spotColor.pdf')); | ||
|
||
// Set some meta data | ||
doc.info['Title'] = 'Test Document for Sport Color'; | ||
|
||
doc.info['Author'] = 'Nicola A.'; | ||
|
||
|
||
// Register a font name for use later | ||
doc.registerFont('Palatino', 'fonts/PalatinoBold.ttf'); | ||
|
||
// Set the font, draw some text, and embed an image | ||
doc | ||
.font('Palatino') | ||
.fontSize(18) | ||
.text('Testing Spot Colors: MYFIRST_SPOT_COLOR, MYSECOND_SPOT_COLOR', 50, 50) | ||
.fontSize(12) | ||
.text('Check it out on Swatches palette', 50, 100) | ||
|
||
// Add another page | ||
// doc | ||
// .addPage() | ||
// .fontSize(25) | ||
// .text('Here is some vector graphics...', 100, 100); | ||
|
||
doc.addSpotColor('MYFIRST_SPOT_COLOR', 0, 50, 0, 0); | ||
doc.addSpotColor('MYSECOND_SPOT_COLOR', 50, 0, 0, 0); | ||
|
||
|
||
// Draw a triangle and a circle | ||
doc | ||
.moveTo(100, 150) | ||
.lineTo(100, 250) | ||
.lineTo(200, 250) | ||
.stroke('MYFIRST_SPOT_COLOR'); | ||
|
||
doc | ||
.moveTo(200, 250) | ||
.lineTo(100, 150) | ||
.lineTo(200, 150) | ||
.lineTo(200, 250) | ||
.fillAndStroke('MYFIRST_SPOT_COLOR', 'MYSECOND_SPOT_COLOR'); | ||
doc.end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters