开发者

iText: setting PDF view defaults

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 iT开发者_运维技巧ext can, but I haven't figured out how or what part of the API I should be looking at. Do you have any suggestions?

Cheers

Nik


You have to use the setViewPreferences of the PdfWriter class. Example:

writer.setViewerPreferences(PdfWriter.FitWindow 
  | PdfWriter.PageModeUseThumbs);

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜