使用itextsharp将格式应用于pdf书签 [英] Apply Formatting to pdf bookmarks using itextsharp

查看:226
本文介绍了使用itextsharp将格式应用于pdf书签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题使用带有C#代码的iTextSharp将页面书签添加到现有PDF中

This is further to my question Add Page bookmarks to an existing PDF using iTextSharp using C# code

在Bruno Lowagie的指导下,我设法使用iTextShrp添加pdf书签,但是现在我需要为书签添加颜色和粗体格式。

With the guidence of Bruno Lowagie i managed to add pdf bookmarks using iTextShrp, but now i need to add color and bold formatting to the bookmarks.

请帮忙...

我确信这是可能的,因为我使用ExportToXML来检索已经格式化的书签,然后它也有格式信息。

I am sure that it is possible , becuase i used ExportToXML to retrieve an already formatted bookmark, then it is having formatting info as well.

推荐答案

就像在我之前的回答中一样,我希望你能请阅读文档

Just like in my previous answer, I would like you to please read the documentation.

您要问的是在 CreateOutlineTree 示例中进行了说明。如果书签的类型为 PdfOutline ,您可以更改样式和字体,如下所示:

What you are asking is explained in the CreateOutlineTree example. If bookmark is of type PdfOutline, you can change the style and font like this:

 bookmark.setStyle(Font.BOLD);
 bookmark.setColor(BaseColor.BLUE);

如果你看示例的C#端口,你会发现iTextSharp略有不同:

If you look at the C# port of the example, you'll discover a slight difference in iTextSharp:

 bookmark.Style = Font.BOLD;
 bookmark.Color = BaseColor.BLUE; 

这篇关于使用itextsharp将格式应用于pdf书签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆