gpt4 book ai didi

javascript - 增加页眉大小 pdfMake

转载 作者:可可西里 更新时间:2023-11-01 02:53:59 26 4
gpt4 key购买 nike

我正在尝试使用 pdfmake 增加 pdf 的标题大小。

目前我可以在页面的左右两侧都得到一个页眉,这是我想要的,但是当高度超过 26 时,图像消失了,因为页眉的空间有限。

  • 可以减少边距以增加尺寸,但我想要余量。
  • 我在 pdfMake github 上搜索了类似的问题,但没有成功。

如果您需要测试任何东西,请尝试我目前拥有的代码 pdfmake playground

请记住,您需要将所有这些代码复制并粘贴到“ Playground ”才能使其正常工作。

var dd = {
pageSize: 'LEGAL',
pageOrientation: 'landscape',
header: {
margin: 8,
columns: [{
table: {
widths: ['50%', '50%'],
body: [
[{
image: 'sampleImage.jpg',
width: 80,
height: 26,
}, {
image: 'sampleImage.jpg',
width: 80,
height: 26,
alignment: 'right'
}]
]
},
layout: 'noBorders'
}]
},
content: [
'First paragraph',
'Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines'
]
}

最佳答案

您需要添加一个 pageMargins 并将第二个参数(上边距)调整为您的总页眉大小。您可以尝试各种值,直到所有 header 内容都可见。

例如:

在这种情况下,我使用 80 (pageMargin: [40,80,40,60]) 来获取高度为 60 的图像

var dd = {

pageSize: 'LEGAL',
pageOrientation: 'landscape',
pageMargins: [40, 80, 40, 60],

header: {
margin: 8,
columns: [
{
table: {
widths: [ '50%','50%'],

body: [
[
{ image: 'sampleImage.jpg',

width: 80, height: 60,

},

{ image: 'sampleImage.jpg',

width: 80, height: 60,
alignment:'right'}
]
]
},
layout: 'noBorders'
}

]
},

content: [
'First paragraph',
'Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines'
]
}

关于javascript - 增加页眉大小 pdfMake,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35020840/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com