Class: Layout::Page

Inherits:
Object
  • Object
show all

Overview

Class for a single page in a LayOut document.

Version:

  • LayOut 2018

Instance Method Summary # collapse

Instance Method Details

#==(other) ⇒ Boolean

The #== method checks to see if the two Layout::Pages are equal. This checks whether the Ruby Objects are pointing to the same internal object.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
document = doc.pages.first.document
doc.pages.first == document.pages.first

Parameters:

Returns:

  • (Boolean)

Version:

  • LayOut 2018

#attribute_dictionary(name) ⇒ Layout::Dictionary?

The #attribute_dictionary method returns a copy of the page's attribute dictionary with the given name.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
page = doc.pages.first
page.set_attribute("jane_doe_doc_maker", "made_by_doc_maker", true)
attributes = page.attribute_dictionary("jane_doe_doc_maker")
# Adding to this Layout::Dictionary does not apply to the page's attribute dictionary, use
# Layout::Page#set_attribute.
attributes.merge!(doc_id: 42)

Parameters:

Returns:

  • (Layout::Dictionary, nil)

    A copy of the page's attribute dictionary, or nil if there is no attribute dictionary

Version:

  • LayOut 2026.0

#delete_attribute(dictionary_name) ⇒ Boolean #delete_attribute(dictionary_name, key) ⇒ Boolean

The #delete_attribute method is used to delete an attribute from a page.

Overloads:

  • #delete_attribute(dictionary_name) ⇒ Boolean

    Examples:

    doc = Layout::Document.open("C:/path/to/document.layout")
    page = doc.pages.first
    page.set_attribute("jane_doe_doc_maker", "made_by_doc_maker", true)
    page.delete_attribute("jane_doe_doc_maker")

    Parameters:

    • dictionary_name (String)

      The name of an attribute dictionary.

    Returns:

    • (Boolean)
  • #delete_attribute(dictionary_name, key) ⇒ Boolean

    Examples:

    doc = Layout::Document.open("C:/path/to/document.layout")
    page = doc.pages.first
    page.set_attribute("jane_doe_doc_maker", "made_by_doc_maker", true)
    page.delete_attribute("jane_doe_doc_maker", "made_by_doc_maker")

    Parameters:

    • dictionary_name (String)

      The name of an attribute dictionary.

    • key (String)

      An attribute key.

    Returns:

    • (Boolean)

Version:

  • LayOut 2026.0

#documentLayout::Document

The #document method returns the Document that the Layout::Page belongs to.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
first_page = doc.pages.first
# page_doc should reference the same document as doc
page_doc = first_page.document

Returns:

Version:

  • LayOut 2018

#entitiesLayout::Entities

The #entities method returns all Entitys that are on the Layout::Page. This is the equivalent of iterating over all LayerInstances and using LayerInstance.entities.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
first_page = doc.pages.first
entities = first_page.entities

Returns:

Version:

  • LayOut 2018

#get_attribute(name, key, default_value = nil) ⇒ String, ...

The #get_attribute method is used to retrieve the value of an attribute in the page's attribute dictionary.

If the third parameter, default_value, is not passed and there is no attribute that matches the given name, it returns nil.

If default_value is provided and there is no matching attribute it returns the given value. It does not create an attribute with that name though.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
page = doc.pages.first
# Read an attribute value from the page. In this case this will return the
# default value provided: 42.
page.get_attribute("jane_doe_doc_maker", "doc_id", 42)

Parameters:

  • name (String)

    The name of an attribute dictionary.

  • key (String)

    An attribute key.

  • default_value (String, Boolean, Integer, Float, Hash, Layout::Dictionary, nil) (defaults to: nil)

    A default value to return if no attribute is found.

Returns:

Version:

  • LayOut 2026.0

#in_presentation=(in_presentation) ⇒ Object

The #in_presentation= method sets whether the Layout::Page is included in presentations.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
first_page = doc.pages.first
first_page.in_presentation = true

Parameters:

  • in_presentation (Boolean)

Version:

  • LayOut 2018

#in_presentation?Boolean

The #in_presentation? method returns whether the Layout::Page is included in presentations.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
first_page = doc.pages.first
in_presentation = first_page.in_presentation?

Returns:

  • (Boolean)

Version:

  • LayOut 2018

#layer_instancesArray<Layout::LayerInstance>

The #layer_instances method returns an array of the LayerInstances for the Layout::Page.

Examples:

# An example of page.layer_instances

Returns:

Version:

  • LayOut 2018

#layer_visible?(layer) ⇒ Boolean

The #layer_visible? method returns whether a Layer is visible on the Layout::Page.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
first_page = doc.pages.first
layer = doc.layers.first
visible = first_page.layer_visible?(layer)

Parameters:

Returns:

  • (Boolean)

Raises:

  • (ArgumentError)

    if layer and page are not in the same document

Version:

  • LayOut 2018

#nameString

The #name method returns the name of the Layout::Page.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
pages = doc.pages
first_page_name = pages.first.name

Returns:

Version:

  • LayOut 2018

#name=(name) ⇒ Object

The #name= method sets the name of a page.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
pages = doc.pages
pages.first.name = "First page"

Parameters:

Raises:

  • (ArgumentError)

    if name is an empty string

Version:

  • LayOut 2018

#nonshared_entitiesLayout::Entities

The #nonshared_entities method returns the Entities unique to the Layout::Page.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
first_page = doc.pages.first
entities = first_page.nonshared_entities

Returns:

Version:

  • LayOut 2018

#set_attribute(name, key, value) ⇒ Object

The #set_attribute method adds an attribute to the page's attribute dictionary.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
page = doc.pages.first
page.set_attribute("jane_doe_doc_maker", "doc_id", 42)

Parameters:

  • name (String)

    The name of an attribute dictionary. @param [String] key An attribute key. @param [String, Boolean, Integer, Float, Hash, Layout::Dictionary, nil] value The value for the

    attribute.
    

Version:

  • LayOut 2026.0

#set_layer_visibility(layer, visible) ⇒ Boolean

The #set_layer_visibility method sets whether a Layer is visible on the Layout::Page.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
first_page = doc.pages.first
layer = doc.layers.first
first_page.set_layer_visibility(layer, false)

Parameters:

Returns:

  • (Boolean)

Raises:

  • (ArgumentError)

    if layer and page are not in the same document

  • (ArgumentError)

    if layer could not be hidden because there must be at least one unlocked, visible layer on each page

Version:

  • LayOut 2018