本文整理汇总了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");
}