mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Fix jsPDF Constructor (#36806)
* Added test for the custom size constructor
* Fix jsPDF Constructor
According to the official jsPDF GitHub: the 3rd parameter in the constructor should be of type String OR Array to allow a custom size.
2f51a5dc2a/src/jspdf.js (L84)
* Added myself to the "Definitions by" section
This commit is contained in:
parent
5440457ff3
commit
5aa0f90d72
3
types/jspdf/index.d.ts
vendored
3
types/jspdf/index.d.ts
vendored
@ -4,13 +4,14 @@
|
||||
// Kevin Gonnord <https://github.com/lleios>
|
||||
// Jackie Weng <https://github.com/jemerald>
|
||||
// Frank Brullo <https://github.com/frankbrullo>
|
||||
// Leon Montealegre <https://github.com/leonmontealegre>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'jspdf' {
|
||||
class jsPDF {
|
||||
constructor(orientation?:any,
|
||||
unit?:string,
|
||||
format?:string,
|
||||
format?:string|Array<Number>,
|
||||
compressPdf?:number);
|
||||
|
||||
CapJoinStyles:any;
|
||||
|
||||
@ -121,6 +121,15 @@ function test_font_metrics_based_line_sizing_split() {
|
||||
pdf.save('Test.pdf');
|
||||
}
|
||||
|
||||
function test_simple_custom_size_document() {
|
||||
var doc = new jsPDF('l', 'px', [500, 200]);
|
||||
doc.text(20, 20, 'Hello world!');
|
||||
doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');
|
||||
doc.addPage();
|
||||
doc.text(20, 20, 'Do you like that?');
|
||||
doc.save('Test.pdf');
|
||||
}
|
||||
|
||||
function test_from_html() {
|
||||
var pdf = new jsPDF('p', 'pt', 'letter')
|
||||
, source = document.getElementById('#fromHTMLtestdiv')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user