docs/jsPDF.html
Source:
{
orientation: 'p',
unit: 'mm',
format: 'a4',
putOnlyUsedFonts:true,
floatPrecision: 16 // or "smart", default is 16
}
| Name | Type | Attributes | Description |
|---|---|---|---|
options | Object | <optional> | |
Collection of settings initializing the jsPDF-instance
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
orientation | string | <optional> | ||
portrait |
Orientation of the first page. Possible values are "portrait" or "landscape" (or shortcuts "p" or "l").
|
| unit | string | <optional>
| mm |
Measurement unit (base unit) to be used when coordinates are specified.
Possible values are "pt" (points), "mm", "cm", "in", "px", "pc", "em" or "ex". Note that in order to get the correct scaling for "px" units, you need to enable the hotfix "px_scaling" by setting options.hotfixes = ["px_scaling"].
|
| format | string/Array | <optional>
| a4 |
The format of the first page. Can be:
Default is "a4". If you want to use your own format just pass instead of one of the above predefined formats the size as an number-array, e.g. [595.28, 841.89] |
| putOnlyUsedFonts | boolean | <optional>
| false |
Only put fonts into the PDF, which were used.
|
| compress | boolean | <optional>
| false |
Compress the generated PDF.
|
| precision | number | <optional>
| 16 |
Precision of the element-positions.
|
| userUnit | number | <optional>
| 1.0 |
Not to be confused with the base unit. Please inform yourself before you use it.
|
| hotfixes | Array.<string> | <optional>
| |
An array of strings to enable hotfixes such as correct pixel scaling.
|
| encryption | Object | <optional>
| |
| Name | Type | Attributes | Description |
|---|---|---|---|
userPassword | string | <optional> | |
Password for the user bound by the given permissions list.
|
| ownerPassword | string | <optional>
|
Both userPassword and ownerPassword should be set for proper authentication.
|
| userPermissions | Array.<string> | <optional>
|
Array of permissions "print", "modify", "copy", "annot-forms", accessible by the user.
|
|
| floatPrecision | number | "smart" | <optional>
| 16 | |
|
jsPDF-instance
Type jsPDF
Source:
constructor ( options )
Initializes Bidi engine
Source:
For compatibility reasons jsPDF offers two API modes which differ in the way they convert between the the usual screen coordinates and the PDF coordinate system.
You can either provide a callback to the body argument, which means that jsPDF will automatically switch back to the original API mode afterwards; or you can omit the callback and switch back manually using compatAPI.
Note, that the calls to saveGraphicsState and restoreGraphicsState need to be balanced within the callback or between calls of this method and its counterpart compatAPI. Calls to beginFormObject or beginTilingPattern need to be closed by their counterparts before switching back to "compat" API mode.
Source:
jsPDF.API is a STATIC property of jsPDF class. jsPDF.API is an object you can add methods and properties to. The methods / properties you add will show up in new jsPDF objects.
One property is prepopulated. It is the 'events' Object. Plugin authors can add topics, callbacks to this object. These will be reassigned to all new instances of jsPDF.
jsPDF.API.mymethod = function(){
// 'this' will be ref to internal API object. see jsPDF source
// , so you can refer to built-in methods like so:
// this.line(....)
// this.text(....)
}
var pdfdoc = new jsPDF()
pdfdoc.mymethod() // <- !!!!!!
Source:
Begins a new tiling pattern. All subsequent render calls are drawn to this pattern until API.endTilingPattern gets called. Only available in "advanced" API mode.
Source:
Is an Object providing a mapping from human-readable to integer flag values designating the varieties of line cap and join styles.
Source:
Switches to "compat" API mode. See advancedAPI for more details.
Source:
Ends a tiling pattern and sets the render target to the one active before API.beginTilingPattern has been called.
Only available in "advanced" API mode.
Source:
The identity matrix (equivalent to new Matrix(1, 0, 0, 1, 0, 0)).
Source:
Source:
Multiplies two matrices. (see Matrix)
Source:
The version of jsPDF.
Source:
Add a custom font to the current instance.
| Name | Type | Description |
|---|---|---|
postScriptName | string |
PDF specification full name for the font.
|
| id | string |
PDF-document-instance-specific label assinged to the font.
|
| fontStyle | string |
Style of the Font.
|
| fontWeight | number | string |
Weight of the Font.
|
| encoding | Object |
Encoding_name-to-Font_metrics_object mapping.
|
fontId
Type string
Source:
Adds a new GState for later use. See setGState.
| Name | Type | Description |
|---|---|---|
key | String | |
gState | GState |
Type jsPDF
Source:
Adds (and transfers the focus to) new page to the PDF document.
| Name | Type | Description |
|---|---|---|
format | String/Array |
The format of the new page. Can be:
Default is "a4". If you want to use your own format just pass instead of one of the above predefined formats the size as an number-array, e.g. [595.28, 841.89] |
| orientation | string |
Orientation of the new page. Possible values are "portrait" or "landscape" (or shortcuts "p" (Default), "l").
|
Type jsPDF
Source:
Adds a new API.ShadingPattern for later use. Only available in "advanced" API mode.
| Name | Type | Description |
|---|---|---|
key | String | |
pattern | Pattern |
Type jsPDF
Source:
Starts a new pdf form object, which means that all consequent draw calls target a new independent object until endFormObject is called. The created object can be referenced and drawn later using doFormObject. Nested form objects are possible. x, y, width, height set the bounding box that is used to clip the content.
| Name | Type | Description |
|---|---|---|
x | number | |
y | number | |
width | number | |
height | number | |
matrix | Matrix |
The matrix that will be applied to convert the form objects coordinate system to the parent's.
|
Type jsPDF
Source:
Adds an circle to PDF.
| Name | Type | Attributes | Description |
|---|---|---|---|
x | number |
Coordinate (in units declared at inception of PDF document) against left edge of the page
|
| y | number | |
Coordinate (in units declared at inception of PDF document) against upper edge of the page
|
| r | number | |
Radius (in units declared at inception of PDF document)
|
| style | string | <optional>
|
A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. In "compat" API mode, a null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument.
In "advanced" API mode this parameter is deprecated.
|
Type jsPDF
Source:
All .clip() after calling drawing ops with a style argument of null.
| Name | Type | Description |
|---|---|---|
rule | string |
Only possible value is 'evenodd'
|
Type jsPDF
Source:
Modify the current clip path by intersecting it with the current path using the even-odd rule. Note that this will NOT consume the current path. In order to only use this path for clipping call API.discardPath afterwards.
Type jsPDF
Source:
Close the current path. The PDF "h" operator.
Type jsPDF
Source:
Inserts a debug comment into the generated pdf.
| Name | Type | Description |
|---|---|---|
text | String |
Type jsPDF
Source:
Append a cubic Bézier curve to the current path. The curve shall extend from the current point to the point (x3, y3), using (x1, y1) and (x2, y2) as Bézier control points. The new current point shall be (x3, x3).
| Name | Type | Description |
|---|---|---|
x1 | number | |
y1 | number | |
x2 | number | |
y2 | number | |
x3 | number | |
y3 | number |
Type jsPDF
Source:
Deletes a page from the PDF.
| Name | Type | Description |
|---|---|---|
targetPage | number |
Type jsPDF
Source:
Consumes the current path without any effect. Mainly used in combination with clip or clipEvenOdd. The PDF "n" operator.
Type jsPDF
Source:
Draws the specified form object by referencing to the respective pdf XObject created with API.beginFormObject and endFormObject. The location is determined by matrix.
| Name | Type | Description |
|---|---|---|
key | String |
The key to the form object.
|
| matrix | Matrix |
The matrix applied before drawing the form object.
|
Type jsPDF
Source:
Adds an ellipse to PDF.
| Name | Type | Attributes | Description |
|---|---|---|---|
x | number |
Coordinate (in units declared at inception of PDF document) against left edge of the page
|
| y | number | |
Coordinate (in units declared at inception of PDF document) against upper edge of the page
|
| rx | number | |
Radius along x axis (in units declared at inception of PDF document)
|
| ry | number | |
Radius along y axis (in units declared at inception of PDF document)
|
| style | string | <optional>
|
A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. In "compat" API mode, a null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument.
In "advanced" API mode this parameter is deprecated.
|
Type jsPDF
Source:
Completes and saves the form object.
| Name | Type | Description |
|---|---|---|
key | String |
The key by which this form object can be referenced.
|
Type jsPDF
Source:
Fill the current path using the nonzero winding number rule. If a pattern is provided, the path will be filled with this pattern, otherwise with the current fill color. Equivalent to the PDF "f" operator.
| Name | Type | Attributes | Description |
|---|---|---|---|
pattern | PatternData | <optional> | |
If provided the path will be filled with this pattern
|
Type jsPDF
Source:
See:
Fill the current path using the even-odd rule. The PDF f* operator.
| Name | Type | Attributes | Description |
|---|---|---|---|
pattern | PatternData | <optional> | |
If provided the path will be filled with this pattern
|
Type jsPDF
Source:
See:
Fill using the nonzero winding number rule and then stroke the current Path. The PDF "B" operator.
| Name | Type | Attributes | Description |
|---|---|---|---|
pattern | PatternData | <optional> | |
If provided the path will be stroked with this pattern
|
Type jsPDF
Source:
See:
Fill using the even-odd rule and then stroke the current Path. The PDF "B" operator.
| Name | Type | Attributes | Description |
|---|---|---|---|
pattern | PatternData | <optional> | |
If provided the path will be fill-stroked with this pattern
|
Type jsPDF
Source:
Get global value of CharSpace.
charSpace
Type number
Source:
| Name | Type | Description |
|---|---|---|
type | Object |
Type Object
Source:
Gets the stroke color for upcoming elements.
colorAsHex
Type string
Source:
GUID.
Type string
Source:
Gets the fill color for upcoming elements.
colorAsHex
Type string
Source:
Gets text font face, variant for upcoming text elements.
Type Object
Source:
Returns an object - a tree of fontName to fontStyle relationships available to active PDF document.
Like {'times':['normal', 'italic', ...], 'arial':['normal', 'bold', ...], ... }
Type Object
Source:
Gets the fontsize for upcoming text elements.
Type number
Source:
Returns the form object specified by key.
| Name | Type | Description |
|---|---|---|
key | String |
Source:
Gets the LineHeightFactor, default: 1.15.
lineHeightFactor
Type number
Source:
Gets the line width, default: 0.200025.
lineWidth
Type number
Source:
Get value of R2L functionality.
jsPDF-instance
Type boolean
Source:
Gets the text color for upcoming elements.
colorAsHex
Type string
Source:
| Name | Type | Description |
|---|---|---|
beforePage | Object |
Type jsPDF
Source:
Draw a line on the current page.
| Name | Type | Description |
|---|---|---|
x1 | number | |
y1 | number | |
x2 | number | |
y2 | number | |
style | string |
A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. A null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument. default: 'S'
|
Type jsPDF
Source:
Adds series of curves (straight lines or cubic bezier curves) to canvas, starting at x, y coordinates. All data points in lines are relative to last line origin. x, y become x1,y1 for first line / curve in the set. For lines you only need to specify [x2, y2] - (ending point) vector against x1, y1 starting point. For bezier curves you need to specify [x2,y2,x3,y3,x4,y4] - vectors to control points 1, 2, ending point. All vectors are against the start of the curve - x1,y1.
.lines([[2,2],[-2,2],[1,1,2,2,3,3],[2,1]], 212,110, [1,1], 'F', false) // line, line, bezier curve, line
| Name | Type | Attributes | Description |
|---|---|---|---|
lines | Array |
Array of vector shifts as pairs (lines) or sextets (cubic bezier curves).
|
| x | number | |
Coordinate (in units declared at inception of PDF document) against left edge of the page
|
| y | number | |
Coordinate (in units declared at inception of PDF document) against upper edge of the page
|
| scale | number | |
(Defaults to [1.0,1.0]) x,y Scaling factor for all vectors. Elements can be any floating number Sub-one makes drawing smaller. Over-one grows the drawing. Negative flips the direction.
|
| style | string | <optional>
|
A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. In "compat" API mode, a null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument.
In "advanced" API mode this parameter is deprecated.
|
| closed | Boolean | <optional>
|
If true, the path is closed with a straight line from the end of the last curve to the starting point.
|
Type jsPDF
Source:
Append a straight line segment from the current point to the point (x, y). The PDF "l" operator.
| Name | Type | Description |
|---|---|---|
x | number | |
y | number |
Type jsPDF
Source:
| Name | Type | Description |
|---|---|---|
targetPage | number | |
beforePage | number |
Type jsPDF
Source:
Begin a new subpath by moving the current point to coordinates (x, y). The PDF "m" operator.
| Name | Type | Description |
|---|---|---|
x | number | |
y | number |
Type jsPDF
Source:
Generates the PDF document.
If type argument is undefined, output is raw body of resulting PDF returned as a string.
| Name | Type | Description |
|---|---|---|
type | string |
A string identifying one of the possible output types.
Possible values are:
'arraybuffer' -> (ArrayBuffer)
'blob' -> (Blob)
'bloburi'/'bloburl' -> (string)
'datauristring'/'dataurlstring' -> (string)
'datauri'/'dataurl' -> (undefined) -> change location to generated datauristring/dataurlstring
'dataurlnewwindow' -> (window | null | undefined) throws error if global isn't a window object(node)
'pdfobjectnewwindow' -> (window | null) throws error if global isn't a window object(node)
'pdfjsnewwindow' -> (wind | null)
|
| options | Object | string |
An object providing some additional signalling to PDF generator.
Possible options are 'filename'.
A string can be passed instead of {filename:string} and defaults to 'generated.pdf'
|
Type string | window | ArrayBuffer | Blob | jsPDF | null | undefined
Source:
Similar to API.lines but all coordinates are interpreted as absolute coordinates instead of relative.
| Name | Type | Description |
|---|---|---|
lines | Array.<Object> |
An array of {op: operator, c: coordinates} object, where op is one of "m" (move to), "l" (line to) "c" (cubic bezier curve) and "h" (close (sub)path)). c is an array of coordinates. "m" and "l" expect two, "c" six and "h" an empty array (or undefined).
|
Type jsPDF
Source:
Adds a rectangle to PDF.
| Name | Type | Attributes | Description |
|---|---|---|---|
x | number |
Coordinate (in units declared at inception of PDF document) against left edge of the page
|
| y | number | |
Coordinate (in units declared at inception of PDF document) against upper edge of the page
|
| w | number | |
Width (in units declared at inception of PDF document)
|
| h | number | |
Height (in units declared at inception of PDF document)
|
| style | string | <optional>
|
A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. In "compat" API mode, a null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument.
In "advanced" API mode this parameter is deprecated.
|
Type jsPDF
Source:
Restores a previously saved graphics state saved by saveGraphicsState ("pops the stack").
Type jsPDF
Source:
Adds a rectangle with rounded corners to PDF.
| Name | Type | Attributes | Description |
|---|---|---|---|
x | number |
Coordinate (in units declared at inception of PDF document) against left edge of the page
|
| y | number | |
Coordinate (in units declared at inception of PDF document) against upper edge of the page
|
| w | number | |
Width (in units declared at inception of PDF document)
|
| h | number | |
Height (in units declared at inception of PDF document)
|
| rx | number | |
Radius along x axis (in units declared at inception of PDF document)
|
| ry | number | |
Radius along y axis (in units declared at inception of PDF document)
|
| style | string | <optional>
|
A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. In "compat" API mode, a null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument.
In "advanced" API mode this parameter is deprecated.
|
Type jsPDF
Source:
Saves as PDF document. An alias of jsPDF.output('save', 'filename.pdf'). Uses FileSaver.js-method saveAs.
| Name | Type | Description |
|---|---|---|
filename | string |
The filename including extension.
|
| options | Object |
An Object with additional options, possible options: 'returnPromise'.
|
jsPDF-instance
Type jsPDF | Promise
Source:
Saves the current graphics state ("pushes it on the stack"). It can be restored by restoreGraphicsState later. Here, the general pdf graphics state is meant, also including the current transformation matrix, fill and stroke colors etc.
Type jsPDF
Source:
Set global value of CharSpace.
| Name | Type | Description |
|---|---|---|
charSpace | number |
jsPDF-instance
Type jsPDF
Source:
| Name | Type | Description |
|---|---|---|
date | Object |
Type jsPDF
Source:
Appends this matrix to the left of all previously applied matrices.
| Name | Type | Description |
|---|---|---|
matrix | Matrix |
Type jsPDF
Source:
Set the display mode options of the page like zoom and layout.
| Name | Type | Description |
|---|---|---|
zoom | integer | String |
You can pass an integer or percentage as a string. 2 will scale the document up 2x, '200%' will scale up by the same amount. You can also set it to 'fullwidth', 'fullheight', 'fullpage', or 'original'.
Only certain PDF readers support this, such as Adobe Acrobat.
|
| layout | string |
Layout mode can be: 'continuous' - this is the default continuous scroll. 'single' - the single page mode only shows one page at a time. 'twoleft' - two column left mode, first page starts on the left, and 'tworight' - pages are laid out in two columns, with the first page on the right. This would be used for books.
|
| pmode | string |
'UseOutlines' - it shows the outline of the document on the left. 'UseThumbs' - shows thumbnails along the left. 'FullScreen' - prompts the user to enter fullscreen mode.
|
Type jsPDF
Source:
Adds a properties to the PDF document.
| Name | Type | Description |
|---|---|---|
A | Object |
property_name-to-property_value object structure.
|
Type jsPDF
Source:
Sets the stroke color for upcoming elements.
Depending on the number of arguments given, Gray, RGB, or CMYK color space is implied.
When only ch1 is given, "Gray" color space is implied and it must be a value in the range from 0.00 (solid black) to to 1.00 (white) if values are communicated as String types, or in range from 0 (black) to 255 (white) if communicated as Number type. The RGB-like 0-255 range is provided for backward compatibility.
When only ch1,ch2,ch3 are given, "RGB" color space is implied and each value must be in the range from 0.00 (minimum intensity) to to 1.00 (max intensity) if values are communicated as String types, or from 0 (min intensity) to to 255 (max intensity) if values are communicated as Number types. The RGB-like 0-255 range is provided for backward compatibility.
When ch1,ch2,ch3,ch4 are given, "CMYK" color space is implied and each value must be a in the range from 0.00 (0% concentration) to to 1.00 (100% concentration)
Because JavaScript treats fixed point numbers badly (rounds to floating point nearest to binary representation) it is highly advised to communicate the fractional numbers as String types, not JavaScript Number type.
| Name | Type | Description |
|---|---|---|
ch1 | Number | String |
Color channel value or {string} ch1 color value in hexadecimal, example: '#FFFFFF'.
|
| ch2 | Number |
Color channel value.
|
| ch3 | Number |
Color channel value.
|
| ch4 | Number |
Color channel value.
|
Type jsPDF
Source:
| Name | Type | Description |
|---|---|---|
value | string |
GUID.
|
Type jsPDF
Source:
Sets the fill color for upcoming elements.
Depending on the number of arguments given, Gray, RGB, or CMYK color space is implied.
When only ch1 is given, "Gray" color space is implied and it must be a value in the range from 0.00 (solid black) to to 1.00 (white) if values are communicated as String types, or in range from 0 (black) to 255 (white) if communicated as Number type. The RGB-like 0-255 range is provided for backward compatibility.
When only ch1,ch2,ch3 are given, "RGB" color space is implied and each value must be in the range from 0.00 (minimum intensity) to to 1.00 (max intensity) if values are communicated as String types, or from 0 (min intensity) to to 255 (max intensity) if values are communicated as Number types. The RGB-like 0-255 range is provided for backward compatibility.
When ch1,ch2,ch3,ch4 are given, "CMYK" color space is implied and each value must be a in the range from 0.00 (0% concentration) to to 1.00 (100% concentration)
Because JavaScript treats fixed point numbers badly (rounds to floating point nearest to binary representation) it is highly advised to communicate the fractional numbers as String types, not JavaScript Number type.
| Name | Type | Description |
|---|---|---|
ch1 | Number | String |
Color channel value or {string} ch1 color value in hexadecimal, example: '#FFFFFF'.
|
| ch2 | Number |
Color channel value.
|
| ch3 | Number |
Color channel value.
|
| ch4 | Number |
Color channel value.
|
Type jsPDF
Source:
Sets text font face, variant for upcoming text elements. See output of jsPDF.getFontList() for possible font names, styles.
| Name | Type | Description |
|---|---|---|
fontName | string |
Font name or family. Example: "times".
|
| fontStyle | string |
Font style or variant. Example: "italic".
|
| fontWeight | number | string |
Weight of the Font. Example: "normal" | 400
|
Type jsPDF
Source:
Sets font size for upcoming text elements.
| Name | Type | Description |
|---|---|---|
size | number |
Font size in points.
|
Type jsPDF
Source:
Sets a either previously added GState (via addGState) or a new GState.
| Name | Type | Description |
|---|---|---|
gState | String | GState |
If type is string, a previously added GState is used, if type is GState it will be added before use.
|
Type jsPDF
Source:
Sets the line cap styles. See {jsPDF.CapJoinStyles} for variants.
| Name | Type | Description |
|---|---|---|
style | String | Number |
A string or number identifying the type of line cap.
|
Type jsPDF
Source:
Sets the dash pattern for upcoming lines.
To reset the settings simply call the method without any parameters.
| Name | Type | Description |
|---|---|---|
dashArray | Array.<number> |
An array containing 0-2 numbers. The first number sets the length of the dashes, the second number the length of the gaps. If the second number is missing, the gaps are considered to be as long as the dashes. An empty array means solid, unbroken lines.
|
| dashPhase | number |
The phase lines start with.
|
Type jsPDF
Source:
Sets the LineHeightFactor of proportion.
| Name | Type | Description |
|---|---|---|
value | number |
LineHeightFactor value. Default: 1.15.
|
Type jsPDF
Source:
Sets the line join styles. See {jsPDF.CapJoinStyles} for variants.
| Name | Type | Description |
|---|---|---|
style | String | Number |
A string or number identifying the type of line join.
|
Type jsPDF
Source:
Sets the miterLimit property, which effects the maximum miter length.
| Name | Type | Description |
|---|---|---|
length | number |
The length of the miter
|
Type jsPDF
Source:
Sets line width for upcoming lines.
| Name | Type | Description |
|---|---|---|
width | number |
Line width (in units declared at inception of PDF document).
|
Type jsPDF
Source:
Adds (and transfers the focus to) new page to the PDF document.
doc = jsPDF()
doc.addPage()
doc.addPage()
doc.text('I am on page 3', 10, 10)
doc.setPage(1)
doc.text('I am on page 1', 10, 10)
| Name | Type | Description |
|---|---|---|
page | number |
Switch the active page to the page number specified (indexed starting at 1).
|
Type jsPDF
Source:
| Name | Type | Description |
|---|---|---|
precision | string |
Type jsPDF
Source:
Set value of R2L functionality.
| Name | Type | Description |
|---|---|---|
value | boolean |
jsPDF-instance
Type jsPDF
Source:
Sets the text color for upcoming elements.
Depending on the number of arguments given, Gray, RGB, or CMYK color space is implied.
When only ch1 is given, "Gray" color space is implied and it must be a value in the range from 0.00 (solid black) to to 1.00 (white) if values are communicated as String types, or in range from 0 (black) to 255 (white) if communicated as Number type. The RGB-like 0-255 range is provided for backward compatibility.
When only ch1,ch2,ch3 are given, "RGB" color space is implied and each value must be in the range from 0.00 (minimum intensity) to to 1.00 (max intensity) if values are communicated as String types, or from 0 (min intensity) to to 255 (max intensity) if values are communicated as Number types. The RGB-like 0-255 range is provided for backward compatibility.
When ch1,ch2,ch3,ch4 are given, "CMYK" color space is implied and each value must be a in the range from 0.00 (0% concentration) to to 1.00 (100% concentration)
Because JavaScript treats fixed point numbers badly (rounds to floating point nearest to binary representation) it is highly advised to communicate the fractional numbers as String types, not JavaScript Number type.
| Name | Type | Description |
|---|---|---|
ch1 | Number | String |
Color channel value or {string} ch1 color value in hexadecimal, example: '#FFFFFF'.
|
| ch2 | Number |
Color channel value.
|
| ch3 | Number |
Color channel value.
|
| ch4 | Number |
Color channel value.
|
Type jsPDF
Source:
Stroke the path. The PDF "S" operator.
Type jsPDF
Source:
Adds text to page. Supports adding multiline text when 'text' argument is an Array of Strings.
| Name | Type | Attributes | Description |
|---|---|---|---|
text | String | Array |
String or array of strings to be added to the page. Each line is shifted one line down per font, spacing settings declared before this call.
|
| x | number | |
Coordinate (in units declared at inception of PDF document) against left edge of the page.
|
| y | number | |
Coordinate (in units declared at inception of PDF document) against upper edge of the page.
|
| options | Object | <optional>
|
Collection of settings signaling how the text must be encoded.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
align | string | <optional> | ||
left |
The alignment of the text, possible values: left, center, right, justify.
|
| baseline | string | <optional>
| alphabetic |
Sets text baseline used when drawing the text, possible values: alphabetic, ideographic, bottom, top, middle, hanging
|
| angle | number | Matrix | <optional>
| 0 |
Rotate the text clockwise or counterclockwise. Expects the angle in degree.
|
| rotationDirection | number | <optional>
| 1 |
Direction of the rotation. 0 = clockwise, 1 = counterclockwise.
|
| charSpace | number | <optional>
| 0 |
The space between each letter.
|
| horizontalScale | number | <optional>
| 1 |
Horizontal scale of the text as a factor of the regular size.
|
| lineHeightFactor | number | <optional>
| 1.15 |
The lineheight of each line.
|
| flags | Object | <optional>
| |
Flags for to8bitStream.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
noBOM | boolean | <optional> | ||
true |
Don't add BOM to Unicode-text.
|
| autoencode | boolean | <optional>
| true |
Autoencode the Text.
|
|
| maxWidth | number | <optional>
| 0 |
Split the text by given width, 0 = no split.
|
| renderingMode | string | <optional>
| fill |
Set how the text should be rendered, possible values: fill, stroke, fillThenStroke, invisible, fillAndAddForClipping, strokeAndAddPathForClipping, fillThenStrokeAndAddToPathForClipping, addToPathForClipping.
|
| isInputVisual | boolean | <optional>
| |
Option for the BidiEngine
|
| isOutputVisual | boolean | <optional>
| |
Option for the BidiEngine
|
| isInputRtl | boolean | <optional>
| |
Option for the BidiEngine
|
| isOutputRtl | boolean | <optional>
| |
Option for the BidiEngine
|
| isSymmetricSwapping | boolean | <optional>
| |
Option for the BidiEngine
|
|
| transform | number | Matrix | |
If transform is a number the text will be rotated by this value around the anchor set by x and y.
If it is a Matrix, this matrix gets directly applied to the text, which allows shearing effects etc.; the x and y offsets are then applied AFTER the coordinate system has been established by this matrix. This means passing a rotation matrix that is equivalent to some rotation angle will in general yield a DIFFERENT result. A matrix is only allowed in "advanced" API mode.
|
Type jsPDF
Source:
Adds a triangle to PDF.
| Name | Type | Attributes | Description |
|---|---|---|---|
x1 | number |
Coordinate (in units declared at inception of PDF document) against left edge of the page
|
| y1 | number | |
Coordinate (in units declared at inception of PDF document) against upper edge of the page
|
| x2 | number | |
Coordinate (in units declared at inception of PDF document) against left edge of the page
|
| y2 | number | |
Coordinate (in units declared at inception of PDF document) against upper edge of the page
|
| x3 | number | |
Coordinate (in units declared at inception of PDF document) against left edge of the page
|
| y3 | number | |
Coordinate (in units declared at inception of PDF document) against upper edge of the page
|
| style | string | <optional>
|
A string specifying the painting style or null. Valid styles include: 'S' [default] - stroke, 'F' - fill, and 'DF' (or 'FD') - fill then stroke. In "compat" API mode, a null value postpones setting the style so that a shape may be composed using multiple method calls. The last drawing method call used to define the shape should not have a null style argument.
In "advanced" API mode this parameter is deprecated.
|
Type jsPDF
Source:
Adds a new Graphics State. Duplicates are automatically eliminated.
| Name | Type | Description |
|---|---|---|
key | String |
Might also be null, if no later reference to this gState is needed
|
| gState | Object |
The gState object
|
Source:
Adds a new pattern for later use.
| Name | Type | Description |
|---|---|---|
key | String |
The key by it can be referenced later. The keys must be unique!
|
| pattern | API.Pattern |
The pattern
|
Source:
Used to see if a supplied hotfix was requested when the pdf instance was created.
| Name | Type | Description |
|---|---|---|
hotfixName | string |
The name of the hotfix to check.
|
Type boolean
Source:
Point
Source:
Rectangle
Source:
FormObject/RenderTarget