iText之pdf书签编辑工具

 需要首先定义标签文件,格式如下:
序号     起始页码 书签名
1        1        第一章
1.1      1        第一章第一节
1.1.1    1       
第一章第一节第一小节
1.1.2    3        第一章第一节第二小节
1.2      4        第一章第二节
2        5        第二章

现在的界面非常简单,只有四个按钮。但确实已经够用。
计划实现这样的功能 :从目录页中自动解析出书签;以图形化的方式编辑书签,而不是写结构化文件。

 

 

 

Adding bookmark or outline tree to PDF

Outline tree can be construct with PdfOutline object. PdfAction can be trigger from outline tree, which executes actions such as goto local page, javascript and hyperlink.

 

 

Code 1
Create 3 pages and set destination to titles. Add 2 sub destination in page 2.

Code 2
Get the root of the outline tree.

Code 3
Add bookmarks for each pages and two sub section to page 2. Bookmarks expanded by default, you can collapse the tree with this code

 

 

 

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值