paragraphs(container, [cb])

Returns a collection of all paragraph objects in the given container. The container object can be a Document, Page, Layer, Group, Story or Text Frame. If a callback function is given, paragraphs() calls this callback function on each paragraph object of the given container. When the callback function returns false, the loop stops and the paragraphs() function returns an array of all paragraphs up to this point.

Type: function

Parameter(s):

  • container {Document | Page | Layer | Group | Story | TextFrame}:

    The document, page, layer, group, story or textFrame instance to iterate the paragraphs in.

  • cb {Function} Optional:

    Optional: The callback function to call with each paragraph. When this function returns false the loop stops. Passed arguments: paragraph, loopCount

Returns:

  • {Paragraphs | Array}:

    A collection or an array of Paragraph objects.