mirror of
https://github.com/foliojs/pdfkit.git
synced 2025-12-08 20:15:54 +00:00
add simple docs
This commit is contained in:
parent
7c12306699
commit
a02ae98737
@ -8,6 +8,7 @@ and some other properties. Here is a list of the available annotation methods:
|
||||
|
||||
* `note(x, y, width, height, contents, options)`
|
||||
* `link(x, y, width, height, url, options)`
|
||||
* `goTo(x, y, w, h, name, options)`
|
||||
* `highlight(x, y, width, height, options)`
|
||||
* `underline(x, y, width, height, options)`
|
||||
* `strike(x, y, width, height, options)`
|
||||
@ -61,6 +62,9 @@ Here is an example that uses a few of the annotation types.
|
||||
.strike(20, doc.y, doc.widthOfString('STRIKE!'), height)
|
||||
.text('STRIKE!');
|
||||
|
||||
// Adding go to as annotation
|
||||
doc.goTo(x, y, w, h, 'LINK', options);
|
||||
|
||||
The output of this example looks like this.
|
||||
|
||||

|
||||
|
||||
@ -194,6 +194,30 @@ capitalized.
|
||||
- `CreationDate` - the date the document was created (added automatically by PDFKit)
|
||||
- `ModDate` - the date the document was last modified
|
||||
|
||||
## Destination
|
||||
|
||||
Anchor may specify a destination by `addNamedDestination(name, ...args)`, which consists of a page, the location of the display window on that page, and the zoom factor to use when displaying that page.
|
||||
|
||||
Examples:
|
||||
|
||||
// Insert anchor for current page
|
||||
doc.addNamedDestination('LINK');
|
||||
|
||||
// Insert anchor for current page with only horizontal magnified to fit where vertical top is 100
|
||||
doc.addNamedDestination('LINK', 'FitH', 100);
|
||||
|
||||
// Insert anchor to display a portion of the current page, 1/2 inch in from the top and left and zoomed 50%
|
||||
doc.addNamedDestination('LINK', 'XYZ', 36, 36, 50);
|
||||
|
||||
// Insert anchor for this text
|
||||
doc.text('End of paragraph', { destination: 'ENDP' });
|
||||
|
||||
// Go to annotation
|
||||
doc.text('Another goto', 20, 0, {
|
||||
goTo: 'ENDP',
|
||||
underline: true
|
||||
});
|
||||
|
||||
## Encryption and Access Privileges
|
||||
|
||||
PDF specification allow you to encrypt the PDF file and require a password when opening the file,
|
||||
|
||||
@ -14,6 +14,9 @@ be scaled according to the following options.
|
||||
* `scale` factor provided - image is scaled proportionally by the provided scale factor
|
||||
* `fit` array provided - image is scaled proportionally to fit within the passed width and height
|
||||
* `cover` array provided - image is scaled proportionally to completely cover the rectangle defined by the passed width and height
|
||||
* `link` - a URL to link this image to (shortcut to create an annotation)
|
||||
* `goTo` - go to anchor (shortcut to create an annotation)
|
||||
* `destination` - create anchor to this image
|
||||
|
||||
When a `fit` or `cover` array is provided, PDFKit accepts these additional options:
|
||||
|
||||
|
||||
@ -97,6 +97,8 @@ below.
|
||||
* `fill` - whether to fill the text (`true` by default)
|
||||
* `stroke` - whether to stroke the text
|
||||
* `link` - a URL to link this text to (shortcut to create an annotation)
|
||||
* `goTo` - go to anchor (shortcut to create an annotation)
|
||||
* `destination` - create anchor to this text
|
||||
* `underline` - whether to underline the text
|
||||
* `strike` - whether to strike out the text
|
||||
* `oblique` - whether to slant the text (angle in degrees or `true`)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user