iText:设置PDF视图默认值 [英] iText: setting PDF view defaults
问题描述
我正在使用iText来通过Java操作我的PDF文件,并且我想这样做以便打开PDF默认值以便单个页面适合它打开的窗口,这个窗口最好是满的屏幕,并在左侧有一个缩略图视图。我知道其他程序可以设置这些视图首选项,所以我假设iText可以,但我还没有想出我应该关注的API的部分或部分。你有什么建议吗?
I'm using iText for a bit of manipulating my PDFs through Java, and I'd like to make it so that a PDF default opens so that a single page fits in the window it opens, that this window is preferrably full screen, and that it has a thumbnail view on the lefthand side. I know other programs can set these view preferences, so I assume iText can, but I haven't figured out how or what part of the API I should be looking at. Do you have any suggestions?
干杯
Nik
推荐答案
您必须使用PdfWriter类的 setViewPreferences
。
示例:
You have to use the setViewPreferences
of the PdfWriter class.
Example:
writer.setViewerPreferences(PdfWriter.FitWindow
| PdfWriter.PageModeUseThumbs);
您还可以有选择地隐藏/显示阅读器用户界面的许多元素,例如 PdfWriter.HideToolbar
flag;您还可以使用 PdfWriter.PageModeFullScreen
标志以全屏模式显示文档,这在某些情况下非常有用。
标记所有位掩码,所以你必须使用 |
运算符。
You can also selectively hide/show many element of the reader user interface, for example with the PdfWriter.HideToolbar
flag; you can also show the document in fullscreen mode, that is very uiseful in some circumstances, with the PdfWriter.PageModeFullScreen
flag.
Flags ara all bit masks, so you have to use the |
operator.
这篇关于iText:设置PDF视图默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!