本文整理匯總了TypeScript中jspdf.save函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript save函數的具體用法?TypeScript save怎麽用?TypeScript save使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了save函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test_font_sizes
function test_font_sizes() {
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.');
doc.save('Test.pdf');
}
示例2: test_simple_two_page_document
function test_simple_two_page_document() {
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();
doc.text(20, 20, 'Do you like that?');
doc.save('Test.pdf');
}
示例3: onPdf
onPdf() {
console.log('create pdf putzplan');
/*jshint newcap: false */
// noinspection JSPotentiallyInvalidConstructorUsage
const pdf = new jsPDF('landscape');
pdf.setFontSize(22);
pdf.text(50, 15, 'Putzplan ' + this.year);
let x = 5;
let y = 50;
const xOffset = 24;
const yOffset = 5;
// iterate over month
for (let month = 0; month < this.month.length; month++) {
y = 30;
pdf.setFontSize(12);
pdf.text(x, y, this.month[month]);
// horizontal line around month names
pdf.line(x - 1, y - 5, x + xOffset - 1, y - 5);
pdf.line(x - 1, y + 1, x + xOffset - 1, y + 1);
y = 35;
// vertical lines
pdf.line(x - 1, y - 10, x - 1, y + 30 * yOffset + 1);
// iterate over days in month
for (let day = 0; day < this.daysInMonth(month + 1); day++) {
// horizontal lines
pdf.line(x - 1, y + 1, x + xOffset - 1, y + 1);
pdf.setFontSize(6);
pdf.text(x, y, this.nameOfDay(day + 1, month + 1) + ', ' + (day + 1) + '.' + (month + 1) + '.');
if (this.nameOfDay(day + 1, month + 1) === 'Sa') {
pdf.setFontSize(8);
pdf.text((x + 10), y, this.workers[this.KalenderWoche(day + 1, month + 1) % this.workers.length]);
}
y += yOffset;
}
x += xOffset;
}
// last vertical line
y = 35;
pdf.line(x - 1, y - 10, x - 1, y + 30 * yOffset + 1);
pdf.save('putzplan.pdf');
}
示例4: test_triangles
function test_triangles() {
var doc = new jsPDF();
doc.triangle(60, 100, 60, 120, 80, 110, 'FD');
doc.setLineWidth(1);
doc.setDrawColor(255, 0, 0);
doc.setFillColor(0, 0, 255);
doc.triangle(100, 100, 110, 100, 120, 130, 'FD');
doc.save('My file.pdf');
}
示例5: test_text_colors
function test_text_colors() {
var doc = new jsPDF();
doc.setTextColor(100);
doc.setTextColor(150);
doc.setTextColor(255, 0, 0);
doc.setTextColor(0, 255, 0);
doc.setTextColor(0, 0, 255);
doc.setTextColor('red');
doc.save('Test.pdf');
}
示例6: test_add_pages_with_different_format
function test_add_pages_with_different_format() {
var doc = new jsPDF();
doc.text(20, 20, 'Hello world!');
doc.addPage('a5', 'l');
doc.text(20, 20, 'Do you like that?');
doc.addPage('c6');
doc.text(20, 20, 'Do you like that?');
doc.addPage([595.28, 841.89]);
doc.text(20, 20, 'Do you like that?');
doc.save('Test.pdf');
}
示例7: test_circles_ellipses
function test_circles_ellipses() {
var doc = new jsPDF();
doc.ellipse(40, 20, 10, 5);
doc.setFillColor(0, 0, 255);
doc.ellipse(80, 20, 10, 5, 'F');
doc.setLineWidth(1);
doc.setDrawColor(0);
doc.setFillColor(255, 0, 0);
doc.circle(120, 20, 5, 'FD');
doc.save('Test.pdf');
}
示例8: test_user_input
function test_user_input() {
var doc = new jsPDF();
doc.text(20, 20, 'This PDF has a title, subject, author, keywords and a creator.');
doc.setProperties({
title: 'Title',
subject: 'This is the subject',
author: 'James Hall',
keywords: 'generated, javascript, web 2.0, ajax',
creator: 'MEEE'
});
doc.save('Test.pdf');
}
示例9: test_text_colors
function test_text_colors() {
var doc = new jsPDF();
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.');
doc.save('Test.pdf');
}
示例10: test_font_types
function test_font_types() {
var doc = new jsPDF();
doc.text(20, 20, 'This is the default font.');
doc.setFont("courier");
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.save('Test.pdf');
}