Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 66 additions & 69 deletions examples/js/acroforms.js
Original file line number Diff line number Diff line change
@@ -1,70 +1,67 @@
var doc = new jsPDF();//{unit: 'px'}

doc.setFontSize(12);
doc.text(10, 105, 'ComboBox:');

var d = new ComboBox();
d.T = "ChoiceField1";
d.TI = 1;
d.Rect = [50, 100, 30, 10];
d.Opt = "[(a)(b)(c)]";
d.V = '(b)';
d.DV = '(b)';
doc.addField(d);

doc.text(10, 115, 'ListBox:');
var d2 = new ListBox();
d2.edit = false;
d2.T = "ChoiceField2";
d2.TI = 2;
d2.Rect = [50, 110, 30, 10];
d2.Opt = "[(c)(a)(d)(f)(b)(s)]";
d2.V = '(s)';
d2.BG = [0, 1, 1];
doc.addField(d2);

doc.text(10, 125, 'CheckBox:');
var checkBox = new CheckBox();
checkBox.T = "CheckBox1";
checkBox.Rect = [50, 120, 30, 10];
doc.addField(checkBox);

doc.text(10, 135, 'PushButton:');
var pushButton = new PushButton();
pushButton.T = "PushButton1";
pushButton.Rect = [50, 130, 30, 10];
pushButton.BG = [1, 0, 0];
doc.addField(pushButton);

doc.text(10, 145, 'TextField:');
var textField = new TextField();
textField.Rect = [50, 140, 30, 10];
textField.multiline = true;
textField.V = "The quick brown fox ate the lazy mouse The quick brown fox ate the lazy mouse The quick brown fox ate the lazy mouse";//
textField.T = "TestTextBox";
//textField.Q = 2; // Text-Alignment
doc.addField(textField);

doc.text(10, 155, 'Password:');
var passwordField = new PasswordField();
passwordField.Rect = [50, 150, 30, 10];
doc.addField(passwordField);

doc.text(50, 165, 'RadioGroup:');
var radioGroup = new RadioButton();
radioGroup.V = "/Test";
radioGroup.Subtype = "Form";

doc.addField(radioGroup);

var radioButton1 = radioGroup.createOption("Test");
radioButton1.Rect = [50, 170, 30, 10];
radioButton1.AS = "/Test";

var radioButton2 = radioGroup.createOption("Test2");
radioButton2.Rect = [50, 180, 30, 10];

var radioButton3 = radioGroup.createOption("Test3");
radioButton3.Rect = [50, 190, 20, 10];

var doc = new jsPDF();//{unit: 'px'}

doc.setFontSize(12);
doc.text('ComboBox:', 10, 105);

var comboBox = new ComboBox();
comboBox.fieldName = "ChoiceField1";
comboBox.topIndex = 1;
comboBox.Rect = [50, 100, 30, 10];
comboBox.setOptions(['a', 'b', 'c']);
comboBox.value = 'b';
comboBox.defaultValue = 'b';
doc.addField(comboBox);

doc.text('ListBox:', 10, 115);
var listbox = new ListBox();
listbox.edit = false;
listbox.fieldName = "ChoiceField2";
listbox.topIndex = 2;
listbox.Rect = [50, 110, 30, 10];
listbox.setOptions(["c", "a", "d", "f", "b", "s"]);
listbox.value = 's';
doc.addField(listbox);

doc.text('CheckBox:', 10, 125,);
var checkBox = new CheckBox();
checkBox.fieldName = "CheckBox1";
checkBox.Rect = [50, 120, 30, 10];
doc.addField(checkBox);

doc.text( 'PushButton:', 10, 135);
var pushButton = new PushButton();
pushButton.fieldName = "PushButton1";
pushButton.Rect = [50, 130, 30, 10];
doc.addField(pushButton);

doc.text('TextField:', 10, 145);
var textField = new TextField();
textField.Rect = [50, 140, 30, 10];
textField.multiline = true;
textField.value = "The quick brown fox ate the lazy mouse The quick brown fox ate the lazy mouse The quick brown fox ate the lazy mouse";//
textField.fieldName = "TestTextBox";
doc.addField(textField);

doc.text('Password:', 10, 155);
var passwordField = new PasswordField();
passwordField.Rect = [50, 150, 30, 10];
doc.addField(passwordField);

doc.text('RadioGroup:', 50, 165);
var radioGroup = new RadioButton();
radioGroup.value = "Test";
radioGroup.Subtype = "Form";

doc.addField(radioGroup);

var radioButton1 = radioGroup.createOption("Test");
radioButton1.Rect = [50, 170, 30, 10];
radioButton1.AS = "/Test";

var radioButton2 = radioGroup.createOption("Test2");
radioButton2.Rect = [50, 180, 30, 10];

var radioButton3 = radioGroup.createOption("Test3");
radioButton3.Rect = [50, 190, 20, 10];

radioGroup.setAppearance(AcroForm.Appearance.RadioButton.Cross);
22 changes: 11 additions & 11 deletions examples/js/autoprint.js

Large diffs are not rendered by default.

355 changes: 177 additions & 178 deletions examples/js/editor.js

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions examples/js/font-faces.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
var doc = new jsPDF();

doc.text(20, 20, 'This is the default font.');

doc.setFont("courier");
doc.setFontType("normal");
doc.text(20, 30, 'This is courier normal.');

doc.setFont("times");
doc.setFontType("italic");
doc.text(20, 40, 'This is times italic.');

doc.setFont("helvetica");
doc.setFontType("bold");
doc.text(20, 50, 'This is helvetica bold.');

doc.setFont("courier");
doc.setFontType("bolditalic");
doc.text(20, 60, 'This is courier bolditalic.');

doc.setFont("times");
doc.setFontType("normal");
doc.text(105, 80, 'This is centred text.', null, null, 'center');
doc.text(105, 90, 'And a little bit more underneath it.', null, null, 'center');
doc.text(200, 100, 'This is right aligned text', null, null, 'right');
doc.text(200, 110, 'And some more', null, null, 'right');
doc.text(20, 120, 'Back to left');

doc.text(20, 140, '10 degrees rotated', null, 10);
doc.text(20, 160, '-10 degrees rotated', null, -10);
var doc = new jsPDF();
doc.text('This is the default font.', 20, 20);
doc.setFont("courier");
doc.setFontStyle("normal");
doc.text('This is courier normal.', 20, 30);
doc.setFont("times");
doc.setFontStyle("italic");
doc.text('This is times italic.', 20, 40);
doc.setFont("helvetica");
doc.setFontStyle("bold");
doc.text('This is helvetica bold.', 20, 50);
doc.setFont("courier");
doc.setFontStyle("bolditalic");
doc.text('This is courier bolditalic.', 20, 60);
doc.setFont("times");
doc.setFontStyle("normal");
doc.text('This is centred text.', 105, 80, null, null, 'center');
doc.text('And a little bit more underneath it.', 105, 90, null, null, 'center');
doc.text('This is right aligned text', 200, 100, null, null, 'right');
doc.text('And some more', 200, 110, null, null, 'right');
doc.text('Back to left',20, 120);
doc.text('10 degrees rotated', 20, 140, null, 10);
doc.text('-10 degrees rotated', 20, 160, null, -10);
12 changes: 6 additions & 6 deletions examples/js/font-size.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var doc = new jsPDF();
doc.setFontSize(22);
doc.text(20, 20, 'This is a title');

doc.setFontSize(16);
doc.text(20, 30, 'This is some normal sized text underneath.');
var doc = new jsPDF();
doc.setFontSize(22);
doc.text('This is a title', 20, 20);
doc.setFontSize(16);
doc.text('This is some normal sized text underneath.', 20, 30);
18 changes: 9 additions & 9 deletions examples/js/images.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions examples/js/japanese.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/js/landscape.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
var doc = new jsPDF('landscape');
doc.text(20, 20, 'Hello landscape world!');
var doc = new jsPDF('landscape');
doc.text('Hello landscape world!', 20, 20);
43 changes: 26 additions & 17 deletions examples/js/text-colors.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
var doc = new jsPDF();

// I know the proper spelling is colour ;)
doc.setTextColor(100);
doc.text(20, 20, 'This is gray.');

doc.setTextColor(150);
doc.text(20, 30, 'This is light gray.');

doc.setTextColor(255, 0, 0);
doc.text(20, 40, 'This is red.');

doc.setTextColor(0, 255, 0);
doc.text(20, 50, 'This is green.');

doc.setTextColor(0, 0, 255);
doc.text(20, 60, 'This is blue.');
var doc = new jsPDF();

// I know the proper spelling is colour ;)
doc.setTextColor(100);
doc.text('This is gray.', 20, 20);

doc.setTextColor(150);
doc.text('This is light gray.', 20, 30);

doc.setTextColor(255, 0, 0);
doc.text('This is red.', 20, 40);

doc.setTextColor(0, 255, 0);
doc.text('This is green.', 20, 50);

doc.setTextColor(0, 0, 255);
doc.text('This is blue.', 20, 60);

doc.setTextColor('red');
doc.text('This is red.', 60, 40);

doc.setTextColor('green');
doc.text('This is green.', 60, 50);

doc.setTextColor('blue');
doc.text('This is blue.', 60, 60);
10 changes: 5 additions & 5 deletions examples/js/two-page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var doc = new jsPDF();
doc.text(20, 20, 'Hello world!');
doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');
doc.addPage('a6','l');
doc.text(20, 20, 'Do you like that?');
var doc = new jsPDF();
doc.text('Hello world!', 20, 20);
doc.text('This is client-side Javascript, pumping out a PDF.', 20, 30);
doc.addPage('l', 'a6');
doc.text('Do you like that?', 20, 20);