This document is about how to set up and use a Story object.
Create a Story object. Add the Story to the Content object then:
<?php use IDML\Content\Story\Story; $myStory = new Story(); $content->addStory($myStory);
If you want to set your own unique identifier, set up the Story like that:
Every text content is written inside a
CharacterStyleRange element and that one lays inside a
ParagraphStyleRange element. This is why we need multiple objects here. The first parameter is always a style object (or null).
<?php use IDML\Content\Story\ParagraphStyleRange; use IDML\Content\Story\CharacterStyleRange; use IDML\Content\SpecialChars\Tabulator; use IDML\Content\Story\Story; use IDML\Content\Story\Text; use IDML\Content\Story\LineBreak; $myStory = new Story(); $myStory->addContent( new ParagraphStyleRange( $myFirstParagraphStyle, new CharacterStyleRange( $myFirstCharacterStyle, new Text('Hello World! '), new LineBreak() ) ), new ParagraphStyleRange( $mySecondParagraphStyle, new CharacterStyleRange( $myFirstCharacterStyle, new Text('New line, new paragraph style. '), new Tabulator(), new Text('Wow, we had a tabulator here! ') ), new CharacterStyleRange( $mySecondCharacterStyle, new Text('Another character style now. ') ) ) ); $content->addStory($myStory);
Orientation and Direction
Per default, orientation and direction are defined from left to right and from top to bottom. If you need to set the story orientation and the direction manually, you can reach this with the help of enums:
<?php use IDML\Content\Enum\Story\Orientation; use IDML\Content\Enum\Story\Direction; $myStory ->setStoryOrientation(Orientation::VERTICAL()) ->setStoryDirection(Direction::RIGHT_TO_LEFT()) ;
Appending to a TextFrame
Every Story needs to be added to a TextFrame.
And don't forget to add it also to your Content object.