在jsPDF的documentation我無法找到一種方法或函數來增加文本行之間的空間。我想知道是否有人知識豐富會點頭分享一些他/她的知識:)。非常感謝。jsPDF調整文本行間距
3
A
回答
3
API.text的輸出確定線高度使用lineHeightProportion:
out(
'BT\n/' +
activeFontKey + ' ' + activeFontSize + ' Tf\n' + // font face, style, size
(activeFontSize * lineHeightProportion) + ' TL\n' + // line spacing
textColor +
'\n' + f2(x * k) + ' ' + f2((pageHeight - y) * k) + ' Td\n(' +
str +
') Tj\nET'
);
改變上述各行到
// (activeFontSize * lineHeightProportion) + ' TL\n' + // line spacing
(activeFontSize * this.lineHeightProportion) + ' TL\n' + // line spacing
並設置變量:
pdf = new jsPDF("portrait", "in", "letter");
pdf.lineHeightProportion = 2;
應該做訣竅。
4
,您還可以在jsPDF構造函數添加參數:
file = new jsPDF({orientation: "p", lineHeight: 1.5)})
從jsPDF碼(功能jsPDF(方向,單位,格式,compressPdf)):
var options = {};
if (typeof orientation === 'object') {
options = orientation;
orientation = options.orientation;
unit = options.unit || unit;
format = options.format || format;
compressPdf = options.compress || options.compressPdf || compressPdf;
}
// Default options
unit = unit || 'mm';
format = format || 'a4';
orientation = ('' + (orientation || 'P')).toLowerCase();
var format_as_string = ('' + format).toLowerCase(),
compress = !!compressPdf && typeof Uint8Array === 'function',
textColor = options.textColor || '0 g',
drawColor = options.drawColor || '0 G',
activeFontSize = options.fontSize || 16,
lineHeightProportion = options.lineHeight || 1.15,
lineWidth = options.lineWidth || 0.200025; // 2mm
相關問題
- 1. HTML調整間距
- 2. 調整僞元素圖像和文本之間的間距
- 3. 在UITextView中調整行間距
- 4. 更改文本行間距
- 5. 使用css調整下劃線和文本之間的距離
- 6. 在R圖中調整x軸與文本之間的距離
- 7. 調整表之間的間距,以html
- 8. ggplot2:如何調整繪圖區域和軸文本之間的間距
- 9. 調整距離
- 10. 調整文字之間的間距在水平傳說
- 11. 如何調整文本行?
- 12. 顯示文本新行和間距
- 13. 消除文本行之間的差距
- 14. 在iOS 7中調整字母間距
- 15. UICollectionView項間距無法調整
- 16. 整合jsPDF在Nativescript
- 17. JSPDF中重疊的文本
- 18. Tkinter的文本小間距
- 19. XSLT 1純文本間距
- 20. 調整R控制檯中的行之間的差距
- 21. 爲框架設定器提供正確的行間距調整
- 22. UIWebView更改源文本中的文本行間距
- 23. 調整菜單文件夾邊距
- 24. 文本中的div之間的間距?
- 25. 文本之間的HTML自動間距
- 26. swift - 如何調整導航欄文本中的字距?
- 27. 構建用於調整字體中字符間距和間距的軟件
- 28. 在文本字段中的行間隔閃存間距
- 29. 如何減少Android佈局中文本之間的行間距?
- 30. HTML調整文本
待辦事項你是指在'text'函數中使用字符串數組時? – Joqus