是的,有可能。 pdfmake 将它们称为向量。看 pdf制作矢量示例以获得更多可能性。
绘制一条线和多边形的示例:
{
canvas:
[
{
type: 'line',
x1: 40, y1: 60,
x2: 260, y2: 60,
lineWidth: 3
},
{
type: 'polyline',
lineWidth: 3,
closePath: true,
points: [{ x: 10, y: 10}, { x: 35, y: 40 }, { x: 100, y: 40 }, { x: 125, y:10 }]
}
]
}
我在 GitHub 上的 pdfMake 中回答了一个问题,如下:
创建一个带有布局标题的表格,您必须定义一个空的正文,否则该行不会出现:
var dd = {
content: [
{
table : {
headerRows : 1,
widths: [200],
body : [
[''],
['']
]
},
layout : 'headerLineOnly'
}
] }
宽度定义线的长度
canvas: [
{
type: 'rect',
x: 198,
y: -186,
w: 198,
h: 188,
r: 8,
lineWidth: 4,
lineColor: '#276fb8',
},
]
@gegobyte 我使用了 @Beka 提到的代码,其中 headerRows : 0,layout : 'lightHorizontalLines' 来减少线宽
{ 桌子 : { 标题行:0, 宽度:['*'], 身体 : [ [''], [''] ] }, 布局:'lightHorizontalLines' },
据我所知,pdfmake不提供绘图API。尽管如此,pdfmake 还是为您提供了一些在 pdf 中插入图像的方法。
致以诚挚的问候!