Apply Formatting to pdf bookmarks using itextsharp

霸气de小男生 提交于 2019-12-24 16:43:10

问题


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

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.

Please help...

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.


回答1:


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

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);

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; 


来源:https://stackoverflow.com/questions/20877294/apply-formatting-to-pdf-bookmarks-using-itextsharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!