javascript - linktoDestination 不适用于 pdfmake
问题描述
目前我正在使用 pdfmake 将 html 转换为 pdf,这是我第一次使用它。
我正在尝试将 Ashish、twitter、aaa 链接到他们的特定部分。我尝试在操场上运行以下代码,但仅用于 aaa 导航到该部分。
// playground requires you to assign document definition to a variable called dd
var dd = {
content: [
{
"columns": [
{
"text": "",
"priority": 0
},
{
"stack": [
"2/17/2021, 2:41:01 PM",
{
"text": "AshishTemplate v4"
}
],
"style": {
"alignment": "right"
},
"priority": 1
}
]
},
{
"text": "\n Table of Contents \n\n",
"style": "header"
},
{
"columns": [
{
"text": "Ashish",
"width": "auto",
"style": "tableOfContents",
"linkToDestination": "Ashish1"
},
{
"text": "Twitter",
"width": "auto",
"style": "tableOfContents",
"linkToDestination": "Twitter1"
},
{
"text": "aaa",
"width": "auto",
"style": "tableOfContents",
"linkToDestination": "aaa"
}
],
"columnGap": 10
},
{
"text": "Ashish",
"style": "sectionHeader",
"id": "Ashish1"
},
"",
{
"columns": [
{
"width": "100%",
"text": ""
}
]
},
{
"text": "Twitter",
"style": "sectionHeader",
"id": "Twitter1"
},
"AShish",
{
"columns": [
{
"style": "listViewTable",
"table": {
"widths": [
"50%",
"50%"
],
"body": [
[
"Address",
"-"
],
]
},
"layout": {
"defaultBorder": false
}
}
]
},
{
"text": "aaa",
"style": "sectionHeader",
"id": "aaa"
},
"aa",
{
"columns": [
{
"width": "100%",
"stack": []
}
]
}
]
}
我错过了什么?Ashish 和 Twitter 不应该有指向他们特定部分的链接吗?我想要的目录输出如下:
Ashish 推特 aaa
并且每当用户将鼠标悬停在文本上时,用户应该能够单击它并导航到该部分。
解决方案
推荐阅读
- microservices - 分布式系统中的用户和帐户管理
- css - IE 10+ 特定的 css 规则在 IE 中不优先
- c# - 以函数式编程兼容的方式交换 C# 中的数组键和值
- codeigniter - ckeidtor - html 值未保存在实时服务器 CI 上的 db 中
- ios - SKLabelNode 显示在 iPhone 模拟上,但不在 iPad 上
- mysql - 如何从 RDS 快照映像重新启用从服务器
- json - 如何在 jmeter 请求的请求中从列表中传递值
- html - 均匀地证明内容空间不将子 div 显示到中心
- android - 有什么方法可以获取应用程序的编译日期吗?反应原生应用
- php - PHP如何将range()用于浮点数