Skip to content

Commit

Permalink
Merge branch 'foliojs:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
liborm85 authored Oct 24, 2021
2 parents 2a477cd + 3525247 commit ce62dad
Show file tree
Hide file tree
Showing 14 changed files with 316 additions and 91,284 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ js/
.vscode
coverage
package-lock.json
/examples/browserify/bundle.js
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

### Unreleased

### [v0.13.0] - 2021-10-24

- Add tiling pattern support

### [v0.12.3] - 2021-08-01

- Remove examples from published package
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const stream = doc.pipe(blobStream());

// add your content to the document here, as usual

// get a blob when you're done
// get a blob when you are done
doc.end();
stream.on('finish', function() {
// get a blob you can do whatever you like with
Expand Down
29 changes: 28 additions & 1 deletion examples/browserify/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,36 @@ function makePDF(PDFDocument, blobStream, lorem, iframe) {
.fill('red', 'even-odd')
.restore();

doc.save();
// a gradient fill
var gradient = doc
.linearGradient(100, 300, 200, 300)
.stop(0, 'green')
.stop(0.5, 'red')
.stop(1, 'green');
doc.rect(100, 300, 100, 100).fill(gradient);

// stroke & fill uncolored tiling pattern

var stripe45d = doc.pattern(
[1, 1, 4, 4],
3,
3,
'1 w 0 1 m 4 5 l s 2 0 m 5 3 l s'
);
doc.circle(280, 350, 50).fill([stripe45d, 'blue']);

doc
.rect(380, 300, 100, 100)
.fillColor('lime')
.strokeColor([stripe45d, 'orange'])
.lineWidth(5)
.fillAndStroke();
doc.restore();

// and some justified text wrapped into columns
doc
.text('And here is some wrapped text...', 100, 300)
.text('And here is some wrapped text...', 100, 450)
.font('Times-Roman', 13)
.moveDown()
.text(lorem, {
Expand Down
Loading

0 comments on commit ce62dad

Please sign in to comment.