JsPDF class
orientation, unit, format
const doc = new jsPDF('p', 'mm', width, height
);
- Available extensions
- Annotations
-
- @JS('window.jspdf.jsPDF')
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addFileToVFS(
dynamic filename, dynamic filecontent) → JsPDF - Add a file to the vFS
-
addFont(
dynamic postScriptName, dynamic fontName, dynamic fontStyle, dynamic fontWeight, [dynamic encoding]) → dynamic - Add a custom font to the current instance.
-
addImage(
dynamic imageData, String format, num x, num y, num width, num height, [dynamic alias, dynamic compression, dynamic rotation]) → dynamic -
format
string format of file if filetype-recognition fails, e.g. 'JPEG'alias
string alias of the image (if used multiple times)compression
string compression of the generated JPEG, can have the values 'NONE', 'FAST', 'MEDIUM' and 'SLOW'rotation
number rotation of the image in degrees (0-359) -
addPage(
[dynamic format, String orientation]) → JsPDF -
format
String/List The format of the new page. Can be: a0 - a10 b0 - b10 c0 - c10 dl letter government-letter legal junior-legal ledger tabloid credit-card -
addSvg(
String svgtext, num x, num y, num w, num h) → JsPDF - Parses SVG XML and converts only some of the SVG elements into PDF elements.
-
addSvgAsImage(
String svg, num x, num y, num w, num h, String alias, String compression, num rotation) → JsPDF - Parses SVG XML and saves it as an image into the PDF.
-
addSvgVector(
Element src, Map< String, dynamic> options) → Future -
Available on JsPDF, provided by the JsPdfExtension extension
extension to add SVG as Vector in PDF from https://raw.githack.com/yWorks/svg2pdf.js/master/dist/svg2pdf.umd.min.j -
autoTable(
dynamic options) → dynamic - from https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.25/jspdf.plugin.autotable.min.js https://github.com/simonbengtsson/jsPDF-AutoTable
-
beginFormObject(
dynamic x, dynamic y, dynamic width, dynamic height, dynamic matrix) → dynamic - Starts a new pdf form object, which means that all consequent draw calls target a new independent object until {@link endFormObject} is called. The created object can be referenced and drawn later using {@link doFormObject}. Nested form objects are possible. x, y, width, height set the bounding box that is used to clip the content.
-
circle(
[dynamic x, dynamic y, dynamic r, dynamic style]) → dynamic - Adds an circle to PDF.
-
clip(
dynamic rule) → dynamic - @name clip @function @instance @param {string} rule Only possible value is 'evenodd' @returns {jsPDF} @memberof jsPDF# @description All .clip() after calling drawing ops with a style argument of null.
-
deletePage(
dynamic number) → dynamic - Deletes a page from the PDF. @name deletePage @memberof jsPDF# @function @param {number} targetPage @instance @returns {jsPDF}
-
doFormObject(
dynamic key, dynamic matrix) → dynamic - Draws the specified form object by referencing to the respective pdf XObject created with {@link API.beginFormObject} and {@link endFormObject}. The location is determined by matrix.
-
ellise(
dynamic x, dynamic y, dynamic rx, dynamic ry, dynamic style) → dynamic - Adds an ellipse to PDF.
-
endFormObject(
dynamic key) → dynamic - Completes and saves the form object. @param {String} key The key by which this form object can be referenced. @function @returns {jsPDF} @memberof jsPDF# @name endFormObject
-
getCharSpace(
) → dynamic - Get global value of CharSpace.
-
getCreationDate(
dynamic type) → dynamic - @name getCreationDate @memberof jsPDF# @function @instance @param {Object} type @returns {Object}
-
getFontList(
) → dynamic - Returns an object - a tree of fontName to fontStyle relationships available to active PDF document.
-
getFontSize(
) → dynamic - Gets the fontsize for upcoming text elements.
-
getStrokeColor(
) → dynamic - Gets the stroke color for upcoming elements.
-
insertPage(
dynamic beforePage) → dynamic - @name insertPage @memberof jsPDF#
-
line(
[dynamic x1, dynamic y1, dynamic x2, dynamic y2, dynamic style]) → dynamic - Draw a line on the current page.
-
lines(
[dynamic lines, dynamic x, dynamic y, dynamic scale, dynamic style, dynamic closed]) → dynamic -
Adds series of curves (straight lines or cubic bezier curves) to canvas, starting at
x
,y
coordinates. All data points inlines
are relative to last line origin.x
,y
become x1,y1 for first line / curve in the set. For lines you only need to specifyx2, y2
- (ending point) vector against x1, y1 starting point. For bezier curves you need to specifyx2,y2,x3,y3,x4,y4
- vectors to control points 1, 2, ending point. All vectors are against the start of the curve - x1,y1. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
output(
[String? type, dynamic options]) → dynamic - Generates the PDF document. If type argument is undefined, output is raw body of resulting PDF returned as a string.
-
path(
dynamic lines, dynamic style, dynamic patternKey, dynamic patternData) → dynamic - Similar to {@link API.lines} but all coordinates are interpreted as absolute coordinates instead of relative. @param {Array
-
rect(
[dynamic x, dynamic y, dynamic w, dynamic h, dynamic style]) → dynamic - Adds a rectangle to PDF.
-
roundedRect(
dynamic x, dynamic y, dynamic w, dynamic h, dynamic rx, dynamic ry, dynamic style) → dynamic - Adds a rectangle with rounded corners to PDF.
-
save(
[String filename, dynamic options]) → JsPDF -
filename
The filename including extension.options
An Object with additional options, possible options: 'returnPromise'. -
saveGraphicsState(
) → dynamic - Saves the current graphics state ("pushes it on the stack"). It can be restored by {@link restoreGraphicsState} later. Here, the general pdf graphics state is meant, also including the current transformation matrix, fill and stroke colors etc. @function @returns {jsPDF} @memberof jsPDF# @name saveGraphicsState
-
setFileId(
dynamic value) → dynamic - @name setFileId @memberof jsPDF# @function @instance @param {string} value GUID. @returns {jsPDF}
-
setFillColor(
[dynamic ch1, dynamic ch2, dynamic ch3, dynamic ch4]) → dynamic - Sets the fill color for upcoming elements.
-
setFont(
String fontName, String fontStyle) → JsPDF -
fontName
Font name or family. Example: "times".fontStyle
Font style or variant. Example: "italic" -
setFontSize(
num size) → JsPDF -
size
Sets font size for upcoming text elements. -
setFontStyle(
dynamic style) → dynamic - Switches font style or variant for upcoming text elements, while keeping the font face or family same. See output of jsPDF.getFontList() for possible font names, styles.
-
setLineWidth(
dynamic width) → dynamic - Sets line width for upcoming lines.
-
setPage(
) → dynamic - Adds (and transfers the focus to) new page to the PDF document. @function @instance @returns {jsPDF}
-
setStrokeColor(
dynamic ch1, dynamic ch2, dynamic ch3, dynamic ch4) → dynamic - Sets the stroke color for upcoming elements.
-
setTextColor(
[dynamic ch1, dynamic ch2, dynamic ch3, dynamic ch4]) → dynamic - Sets the text color for upcoming elements.
-
svg(
Element svgElement, dynamic jsMapOptions) → dynamic -
jsMapOptions
JsObject/JsPDFSvgOptions { x: x, y: y, width: width, height: height }svgElement
html svg element from -
text(
dynamic text, num x, num y, [dynamic options, dynamic transform]) → JsPDF -
text
String | List 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
JsObject Collection of settings signaling how the text must be encoded. -
toString(
) → String -
A string representation of this object.
inherited
-
triangle(
dynamic x1, dynamic y1, dynamic x2, dynamic y2, dynamic x3, dynamic y3, dynamic style) → dynamic - Adds a triangle to PDF.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited