Class: PDF::Writer::Object::ViewerPreferences

Inherits:
PDF::Writer::Object show all
Defined in:
lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/viewerpreferences.rb

Overview

Set the viewer preferences.

HideToolbar

boolean (Optional) A flag specifying whether to hide the viewer application? tool bars when the document is active. Default value: false.

HideMenubar

boolean (Optional) A flag specifying whether to hide the viewer application? menu bar when the document is active. Default value: false.

HideWindowUI

boolean (Optional) A flag specifying whether to hide user interface elements in the document? window (such as scroll bars and navigation controls), leaving only the document? contents displayed. Default value: false.

FitWindow

boolean (Optional) A flag specifying whether to resize the document? window to fit the size of the first displayed page. Default value: false.

CenterWindow

boolean (Optional) A flag specifying whether to position the document? window in the center of the screen. Default value: false.

NonFullScreenPageMode

name (Optional) The document? page mode, specifying how to display the document on exiting full-screen mode. This entry is meaningful only if the value of the PageMode entry in the catalog dictionary is FullScreen; it is ignored otherwise. Default value: UseNone.

Direction

name (Optional; PDF 1.3) The predominant reading order for text: L2R Left to right R2L Right to left (including vertical writing systems such as Chinese, Japanese, and Korean) This entry has no direct effect on the document? contents or page numbering, but can be used to determine the relative positioning of pages when displayed side by side or printed n-up. Default value: L2R.

NonFullScreenPageMode Names

UseNone

Neither document outline nor thumbnail images visible

UseOutlines

Document outline visible

UseThumbs

Thumbnail images visible

Note that boolean values are represented by the values ‘true’ and ‘false’. Also note that I have not done much testing on changing these values and am not sure how responsive the various viewers and browsers are to them (and setting the direction would be fairly meaningless as none of these character sets are avaliable yet.

Constant Summary collapse

Preferences =
%w{HideToolbar HideMenubar HideWindowUI FitWindow CenterWindow NonFullScreenPageMode Direction}

Instance Attribute Summary

Attributes inherited from PDF::Writer::Object

#oid

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ ViewerPreferences

Returns a new instance of ViewerPreferences.



58
59
60
# File 'lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/viewerpreferences.rb', line 58

def initialize(parent)
  super(parent)
end

Instance Method Details

#to_sObject



66
67
68
69
70
71
72
73
# File 'lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/viewerpreferences.rb', line 66

def to_s
  res = "\n#{@id} 0 obj\n<< "
  Preferences.each do |s|
    v = __send__("#{s.downcase}".intern)
    res << "\n/#{s} /#{v}" unless v.nil?
  end
  res << "\n>>\n"
end