本文整理匯總了TypeScript中jspdf.text函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript text函數的具體用法?TypeScript text怎麽用?TypeScript text使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了text函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
const addLine = (text: string, customPadding: number) => {
doc.text(text, customPadding, currentLine, {
charSpace: 0.75,
align: 'center'
});
currentLine += fontSize * 2;
};
示例2: test_autoprint
function test_autoprint() {
const doc = new jsPDF()
doc.text('This is a test', 10, 10)
doc.autoPrint()
doc.autoPrint({ variant: 'javascript' })
}
示例3: 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');
}
示例4: 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');
}
示例5: test_viewerpreferences
function test_viewerpreferences() {
const doc = new jsPDF()
doc.text('This is a test', 10, 10)
doc.viewerPreferences({ 'HideToolbar': true })
doc.viewerPreferences({ 'HideMenubar': true })
doc.viewerPreferences({ 'HideWindowUI': true })
doc.viewerPreferences({ NumCopies: 9 })
doc.viewerPreferences({ 'HideWindowUI': true })
doc.viewerPreferences({ 'FitWindow': true }, true)
doc.viewerPreferences({ 'ViewArea': 'MediaBox' })
doc.viewerPreferences({ 'PrintPageRange': [[1, 3], [5, 9]] })
doc.viewerPreferences({ 'HideWindowUI': true })
doc.viewerPreferences('reset')
doc.viewerPreferences({ 'FitWindow': true })
}
示例6: test_font_metrics_based_line_sizing_split
function test_font_metrics_based_line_sizing_split() {
var pdf = new jsPDF('p', 'in', 'letter');
var sizes:number[] = [12, 16, 20];
var fonts = [['Times', 'Roman'], ['Helvetica', ''], ['Times', 'Italic']];
var font:string[];
var size:number;
var lines:any[];
var verticalOffset = 0.5; // inches on a 8.5 x 11 inch sheet.
var loremipsum = 'Lorem ipsum dolor sit amet, ...';
for (var i in fonts) {
if (fonts.hasOwnProperty(i)) {
font = fonts[i];
size = sizes[i];
lines = pdf.setFont(font[0], font[1])
.setFontSize(size)
.splitTextToSize(loremipsum, 7.5);
pdf.text(0.5, verticalOffset + size / 72, lines);
verticalOffset += (lines.length + 0.5) * size / 72
}
}
pdf.save('Test.pdf');
}
示例7: test_landscape
function test_landscape() {
var doc = new jsPDF('landscape');
doc.text(20, 20, 'Hello landscape world!');
doc.save('Test.pdf');
}
示例8: test_font
function test_font() {
var doc = new jsPDF();
doc.text('This is the default font.',20, 20);
doc.setFont("courier");
}