mirror of
https://github.com/foliojs/pdfkit.git
synced 2025-12-08 20:15:54 +00:00
Emit an event when a page is added
Use the document as the EventEmitter Update docs
This commit is contained in:
parent
a04155fc76
commit
fbcb53855e
@ -85,6 +85,11 @@ quite simple!
|
||||
|
||||
doc.addPage()
|
||||
|
||||
To add some content every time a page is created, either by calling `addPage()` or automatically, you can use the `pageAdded` event.
|
||||
|
||||
doc.on 'pageAdded', ->
|
||||
doc.text "Page Title"
|
||||
|
||||
You can also set some options for the page, such as it's size and orientation.
|
||||
|
||||
The `layout` property can be either `portrait` (the default) or `landscape`.
|
||||
|
||||
@ -99,6 +99,8 @@ class PDFDocument extends stream.Readable
|
||||
# the top left rather than the bottom left
|
||||
@_ctm = [1, 0, 0, 1, 0, 0]
|
||||
@transform 1, 0, 0, -1, 0, @page.height
|
||||
|
||||
@emit('pageAdded')
|
||||
|
||||
return this
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user