Skip to content

Working With SDK Components

This section will help the developers to understand each component in SDK, as now we already know what is Default Kitaboo Reader and how to do the initialisation, in this section we will see how each component works, how it can be customized if required, for instance, if a developer wants to write a completely new reader or customize some feature, this section will help them to do so.

Renderer

Class: RendererViewController

RendererViewController is a class exposed by Kitaboo SDK which renders the content/media based on their types [KitabooFixed (PDF version), ePubFixed or ePubReflowable]. This will take input as a path of content/book and create their respective view controller accordingly. Simply put, RendererViewController is an object that will be responsible for rendering of a media/content.

Protocol: RendererViewControllerDelegate

The RendererViewControllerDelegate protocol defines methods that allow users to manage the selection, highlighting, page loading, zoom in/out and all actions/events that are directly related to rendering of book (KitabooFixed, ePub). All the methods of this protocol are optional.

When configuring the renderer view object, assign your delegate object to its delegate property.

Note

The delegate of a RendererViewController object must adopt the RendererViewControllerDelegate protocol._

Usage: RendererViewController

Initiate RenderViewController (Objective C)

  • Create an instance of RendererViewController by passing the parameters as given below in the code snippet.
  • It returns a newly allocated renderer view object with specified parameters.
  • Add the renderer view Object to Reader as given in below Code snippet.
RendererViewController  *rendererViewController = [[RendererViewController alloc] initWithBookPath:@"" WithDelegate:self];
 [self addChildViewController:rendererViewController];
  [self.view insertSubview:rendererViewController.view atIndex:0];
    rendererViewController.view.translatesAutoresizingMaskIntoConstraints = NO;
    UIView *view = rendererViewController.view;
    NSDictionary *dictionary = NSDictionaryOfVariableBindings(view);
    NSString *vfString = @"H:|-0-[view]-0-|";
    NSArray *horizontalConstraints = [NSLayoutConstraint constraintsWithVisualformat:vfString
                                                                             options:0
                                                                             metrics:nil
                                                                               views:dictionary];
    vfString = @"V:|-0-[view]-0-|";
    NSArray *verticalConstraints = [NSLayoutConstraint constraintsWithVisualformat:vfString
                                                                           options:0
                                                                           metrics:nil
                                                                             views:dictionary];
    [self.view addConstraints:horizontalConstraints];
    [self.view addConstraints:verticalConstraints];
Parameter Name Description
bookPath

String

The physical book path where book is available
delegate

RendererViewControllerDelegate

A callback listener, RendererViewController object must adopt the RendererViewControllerDelegate protocol

Pentool

Class: PenToolController

PenToolController is responsible for handling drawing on Canvas. Canvas is a drawing area where users can draw qith a PenToolController. And the PenToolController class is responsible for handling customisation of a pen such as pen color, pen thickness etc.

Protocol: PenToolControllerDelegate

The PenToolControllerDelegate protocol defines methods that allow users to perform actions when any drawing is created, updated or deleted by the user. Also when undoable status of pentool gets updated. When configuring the PenToolController object, assign your delegate object to its delegate property.

Note

The delegate of a PenToolController object must adopt the PenToolControllerDelegate protocol.

Usage: PenToolController

Initiate PenToolViewController (Objective C)

  • Create an instance of PenToolControler as given below in the code snippet.
  • It returns a newly allocated pen tool object,
  • Set your delegate to pen tool delegate property.
  • Set Pen drawing canvas which is provided by renderer view as given below in the code snippet.
  • Set pen's color and stroke thickness as given below in the code snippet.
PenToolController *penToolController = [[PenToolController alloc]init];
[penToolController setDelegate:self];
[penToolController setPenDrawingCanvas:[rendererViewController getPenDrawingCanvas]];
[penToolController setDrawingMode:DRAWING_MODE_NORMAL];
[penToolController setPenMode:PenModeDrawing];
[penToolController setPenColor:@"#4aaf7c"];
[penToolController setPenStrokeThickness:8.0];
Parameter Name Description
delegate

PenToolControllerDelegate

A callback listener, PenToolController object must adopt the PenToolControllerDelegate protocol.
canvas

NSArray

Canvas in the Drawing area that we receive from RendererViewController. In case of landscape mode, there can be two canvases available, and for portrait there will be one canvas. [As the Number of Pages differ in both cases]
drawingMode

DRAWING_MODE

DRAWING_MODE is a mode of drawing mode, whether it can be DRAWING_MODE_NORMAL or DRAWING_MODE_REVIEW.
penMode

PenMode

PenMode is used to set the Type of Mode for PenToolController. It can be PenModeDrawing or PenModeSelection.
penColor

NSString

Provides Pen Color.
penThickness

float

Provides Pen Thickness.

Customisations

Below are some customisations that developerss can perform on Pen Tool:

  • To change the pen color.
    • Example Code snippet:
        [penToolController setPenColor:@"#4aaf7c"];
  • To change pen thickness.
    • Example Code snippet:
        [penToolController setPenStrokeThickness:8.0];
  • To set pen canvas.
    • Example Code snippet:
        [penToolController setPenDrawingCanvas: [ rendererViewController          getPenDrawingCanvas]];
  • To set pen mode.
    • Example Code snippet:
        [penToolController setPenMode:PenModeDrawing];
  • To enable/disable delete on selection.
    • Example Code snippet:
        [penToolController setDeleteOnSelectionEnabled:YES];

PlayerActionBar

KitabooSDK exposes a class "PlayerActionBar" which helps you in creating action bars such as Top Bar, Bottom bar, Pen Tool Bar, which behaves as the container for action Items of Type "PlayerActionBarItem" class. developers can add one or many items in PlayerActionBar.

Class: PlayerActionBar

An object that will be responsible for creation of Player Action Bar, this is a container which contains an object of type PlayerActionBarItem.

Protocol: PlayerActionDelegate

The PlayerActionDelegate protocol defines methods that allow users to perform an action when any item from player action bar is selected.

Class: PlayerActionBarItem

An object that will be responsible for creation of Player Action Bar Item.

Protocol: PlayerItemDelegate

The PlayerItemDelegate Protocol handles all the callbacks of PlayerActionBarItem class. The PlayerItemDelegate protocol defines methods that allow users to perform action when PlayerActionBarItem object is selected.

Usage: PlayerActionBar & PlayerActionBarItem

Initiate PlayerActionBar (Objective C)

  • Create an instance of PlayerActionBar by passing the parameter as given below in the code snippet.
  • It returns a newly allocated PlayerActionBar object with specified parameters.
  • Set your delegate to player action bar delegate property.
  • Add method "addActionBarItem" exposed by PlayerActionBar which allows the developers to add item on player action bar.
  • Add the player action bar object to Reader as given in below code snippet.

Initiate PlayerActionBarItem (Objective C)

  • Create an instance of PlayerActionBarItem by passing the parameter as given below in the code snippet.
  • It returns a newly allocated PlayerActionBarItem object with specified parameters.

Code snippet for Initializing PlayerActionBar:

PlayerActionBar *playerActionBarView = [[PlayerActionBar alloc]initWithFrame:CGRectZero];
playerActionBarView.delegate =self;
[self.view addSubview:playerActionBarView];

 playerActionBarView.translatesAutoresizingMaskIntoConstraints =NO;
    [self.view addConstraint:[NSLayoutConstraint constraintWithItem: playerActionBarView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:20]];
    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:playerActionBarView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0]];
    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:playerActionBarView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeHeight multiplier:1.0 constant:60]];
    [self.view addConstraint:[NSLayoutConstraint constraintWithItem: playerActionBarView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]];
Parameter Name Description
playerActionBarframe

CGReact

The frame rectangle for the Player Action Bar, measured in points.
delegate

PlayerActionDelegate

A callback listener, PlayerActionBar object must adopt the PlayerActionDelegate protocol.

Code snippet for Creating PlayerActionBar Item

    PlayerActionBarItem *actionBarItem=[[PlayerActionBarItem alloc]initWithFrame:CGRectZero ];
    UILabel *textforAction = [[UILabel alloc]init];
    [textforAction setText:@"Z"];
    [textforAction setTextAlignment:NSTextAlignmentCenter];
    [textforAction setFont:[UIFont fontWithName:@"font_name" size:25]];
    textforAction.textColor = UIColor.blueColor;
    [actionBarItem addSubview:textforAction];
    textforAction.translatesAutoresizingMaskIntoConstraints =NO;
    [actionBarItem addConstraint:[NSLayoutConstraint constraintWithItem: textforAction attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:actionBarItem attribute:NSLayoutAttributeTop multiplier:1.0 constant:10]];
    [actionBarItem addConstraint:[NSLayoutConstraint constraintWithItem:textforAction attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:actionBarItem attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]];
    [actionBarItem addConstraint:[NSLayoutConstraint constraintWithItem:textforAction attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:50]];
    [actionBarItem addConstraint:[NSLayoutConstraint constraintWithItem: textforAction attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:actionBarItem attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-10]];
Parameter Name Description
playerActionBarItemFrame

CGReact

The frame rectangle for the Player Action Bar Item, measured in points.

Code snippet for adding PlayerActionBar Item on Player Action Bar

[playerActionBarView addActionBarItem:actionBarItem withItemsWidth:50 withItemAlignments:PlayerActionBarAlignmentLeft isTappable:YES];
Parameter Name Description
actionBarItem

PlayerActionBarItem

Returns item of type PlayerActionBarItem which will be added on action bar.
width

float

Width will be the width of the added item.
alignment

PlayerActionBarAlignment

PlayerActionBarAlignment decides the alignment of added item, where it will be added on player action bar.
  • for PlayerActionBarAlignmentLeft, item will be added on the left side of player action bar.

    • for PlayerActionBarAlignmentRight, item will be added on the right side of player action bar.

      • for PlayerActionBarAlignmentCenter, item will be added on center of player action bar.

isTappable

BOOL

This decides whether the item is tappable or not.
playerActionBarItemFrame

CGReact

The frame rectangle for the Player Action Bar Item, measured in points.

Customisations

Below are some customisations that developerss can perform on PlayerActionBar:

  • To enable and disable user interaction with items on the Action Bar.
    • Example Code snippet:
        playerActionBarView enableItemWithTag: 2 WithIsEnabled:YES];
  • To Hide and Unhide Items on the Action Bar
    • Example Code snippet:
        [playerActionBarView hideItemWithTag:3 WithIsHidden:NO];
  • To reset the selected items.
    • Example Code snippet:
        [playerActionBarView resetPlayerActionBarSelection];

Below are some customisations that developerss can perform on PlayerActionBarItem:

  • To enable/disable player action bar item.
    • Example Code snippet:
        actionBarItem.enabled = YES;
  • To select and unselect player action bar item.
    • Example Code snippet:
        actionBarItem.selected = YES;

Highlight

Highlight is a feature supported by KitabooSDK which helps the user to highlight the sentence/words/characters available on the pages with a specific color.

KitabooSDK provides the flexibility to customize the highlight color, which means users can add multiple highlight color icons, contextual note icons, search and delete icons to the highlight pop up.

To add items on highlight pop up "HighlightItem" class is used. developers can add one or more than one HighlightItem on highlight pop up.

Class: HighlightActionView

An object that will be responsible for creation of highlight pop up. HighlightActionView is a container, which can contain multiple Items of Type HighlightItem.

Protocol: HighlightActionViewDelegate

The HighlightActionViewDelegate protocol defines methods that allow users to perform action when any item from highlight pop up is selected.

Class: HighlightItem

An object that will be responsible for creation of highlight Item.

Protocol: HighlightItemDelegate

The HighlightItemDelegate Protocol handles all the callbacks of HighlightItem class. The HighlightItemDelegate protocol defines methods that allow users to perform action when HighlightItem object is selected.

Usage: HighlightActionView & HighlightItem

Initiate HighlightActionView (Objective C)

  • Create an instance of HighlightActionView by passing the parameter as given below in the code snippet.
  • It returns a newly allocated HighlightActionView object with specified parameters.
  • Set your delegate to highlight action view delegate property.
  • Add method "addHighlightItem" exposed by HighlightActionView which allows the developers to add item on highlight pop up.
  • Add the highlight action bar object to Reader as given in below code snippet.

Initiate HighlightItem (Objective C)

  • Create an instance of HighlightItem by passing the parameter as given below in the code snippet.
  • It returns a newly allocated PlayerActionBarItem object with specified parameters.

Code snippet for Initializing HighlightActionView:

HighlightActionView *highlightView = [[HighlightActionView alloc] initWithItemSize:CGSizeMake(50, 50)];
 [highlightView setDelegate:self];
 highlightView.layer.cornerRadius = CGRectGetHeight(highlightView.bounds) * 0.5;
 [rendererViewController setHighlightView:highlightView];
Parameter Name Description
frame

CGReact

The frame rectangle for the Highlight Action View, measured in points.
delegate

HighlightActionViewDelegate

A callback listener, HighlightActionView object must adopt the HighlightActionViewDelegate protocol.

Code snippet for Creating Highlight Item

 HighlightItem *item1_yellow_color =  [[HighlightItem alloc]initWithFrame:CGRectMake(0, 0, 50, 50) WithAction:^{
    }];
    UILabel *textforAction = [[UILabel alloc]initWithFrame:item1_yellow_color.frame];
    textforAction.text = @"Y";
    [textforAction setText:@"T"];
    [textforAction setTextAlignment:NSTextAlignmentCenter];
    textforAction.textColor = [UIColor colorWithHexString:@YellowColor];
    [item1_yellow_color addSubview:textforAction];
Parameter Name Description
frame

CGReact

The frame rectangle for the Highlight Item, measured in points.
action

Block

Block, needs to be performed when user selects the item.

Code snippet for adding Highlight Item on HighlightActionView

[highlightView addHighlightItem:item1_yellow_color];

As above, user can add multiple items to highlight pop up.
[highlightView addHighlightItem:item2_red_color];
[highlightView addHighlightItem:item3_note];
[highlightView addHighlightItem:item4_search];
[highlightView addHighlightItem:item5_delete];
Parameter Name Description
item

HighlightItem

Returns item of type HighlightItem which will be added on highlight pop up.

Customisations

Below are some customisations that developerss can perform on HighlightItem:

  • To enable/disable player highlight item.
    • Example Code snippet:
        item1_yellow_color.enabled = YES;
  • To select and unselect highlight item.
    • Example Code snippet:
        item1_yellow_color.selected = YES;

Notes

Class: HSNoteController

KitabooSDK exposes a class "HSNoteController", which is responsible for Note (Creation, Deletion and Updation), HSNoteController takes input as SDKHightlightVO, which behaves as the data source for HSNoteController.

Protocol: HSNoteControllerDelegate

HSNoteControllerDelegate method gets called when a user selects any button (Cancel, Post, Delete) available on note controller. When configuring the HSNoteController object, assign your delegate object to its delegate property.

Usage: HSNoteController

Initiate HSNoteController(Objective C)

  • Create an instance of HSNoteController by passing the parameter as given below in the code snippet.
  • It returns a newly allocated HSNoteController object with specified parameters.
  • Set your delegate to note controller delegate property.

Code snippet for Initializing HSNoteController:

HSNoteController *_noteController = [[HSNoteController alloc] initWithNibName:@"HSNoteController"
                                                         bundle:[NSBundle bundleforClass:[HSNoteController class]]];
[_noteController showShareButton:NO];
        _noteController.delegate = self;
_noteController.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController *popoverpresentationController = [_noteController popoverPresentationController];
popoverpresentationController.permittedArrowDirections = 0;
popoverpresentationController.delegate = self;
popoverpresentationController.sourceView = self.view;
popoverpresentationController.sourceRect = CGRectMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds),0,0);
popoverpresentationController.presentedViewController.preferredContentSize = CGSizeMake(420, 737);
[self presentViewController:_noteController animated:YES completion:nil];
Parameter Name Description
delegate

HSNoteControllerDelegate

A callback listener, HSNoteController object must adopt the HSNoteControllerDelegate protocol.

Code snippet for adding contextual note:

_noteController.highlight = sdkHighlightVO;

Parameter Name Description
highlight

SDKHighlightVo

Highlight is an object of type SDKHighlightVO.
  • To add contextual note, a method of renderer view is called "getHighlightforSelectedTextWithTextColor", which returns SDKHighlightVO object with all the information about the highlight(Contextual Note).

Code snippet for adding sticky note:

SDKHighlightVO *sdkHighlightVO = [rendererView getHighlightVOforStickyNoteWithDefaultPosition];
_noteController.highlight = sdkHighlightVO;
Parameter Name Description
highlight

SDKHighlightVo

Highlight is an object of type SDKHighlightVO.
  • To add Sticky note, a method of renderer view is called "getHighlightVOforStickyNoteWithDefaultPosition", which returns SDKHighlightVO object with all the information about the Sticky Note.
  • Default Positions for sticky note are: Center of Page in case of Landscape Left Page/or Portrait Mode, and Center Left Position in case of Landscape mode right mode

Callback:

When users create any note, a mandatory callback method of renderer view is called.

-(UGCLabel )noteIconViewforHighlight:(SDKHighlightVO)highlightVO

All the customizations related to note highlight icon can be performed here.(eg. If SDKHighlightVO instance is a type of sticky note, sticky note icon will be added, or else contextual note icon will be added.)

Customisations

Below are some customisations that developers can perform on HSNoteController:

  • To show or hide Post button present on note
    • Example Code snippet:
        [_noteController showPostButton:YES];
  • To show or hide Share button present on note
    • Example Code snippet:
        [_noteController showShareButton:YES];
  • To set the color for shared Highlight/Notes
    • Example Code snippet:
        [_noteController setColorforSharedUGC:@"#ffffff"];
  • To set the tint color of input field in note controller
    • Example Code snippet:
        [_noteController setTextViewTintColor:@"#ffffff"];

Bookmark

Bookmark is a shortcut to specific page of a book. Bookmark allows to easily access the favorite location on the content.

KitabooSDK provides two classes for handling Bookmarks on a page. To add bookmark on page, developers can use "BookMarkView" class, and to present an input field which appears after tapping on the bookmark icon where user can add his/her data, developerss can use "BookMarkController" class.

Class: BookMarkView

The BookMarkView is a view where its state changes from selected to normal and vice versa. Initially, BookmarkView will be in the normal state. BookmarkView changes its state to selected when the desired text is provided in the input field of BookMarkController. BookmarkView state changes from selected to normal when the user removes the complete text in the input field of BookMarkController. SDKBookmarkVO is the datasource object.

Example

Bookmark in selected state.Bookmark in normal state.

Protocol: BookMarkViewDelegate

The BookMarkViewDelegate protocol defines methods that allow users to perform an action when bookmark icon is tapped.

When configuring the BookMarkView object, assign your delegate object to its delegate property.

Class: BookMarkController

The BookMarkController is a container view where user can insert his/her bookmark data. SDKBookmarkVO is the datasource object.

Protocol: BookmarkControllerDelegate

The BookmarkControllerDelegate protocol defines methods that allow users to perform actions when bookmark is completed.

When configuring the BookMarkController object, assign the delegate object to its delegate property.

Usage: BookMarkView & BookMarkController

Initiate BookMarkView (Objective C)

  • Create an instance of BookMarkView.
  • Set page number where bookmark to be added.
  • Set your delegate to bookmark view delegate property.
  • A method "addBookmarkView" exposed by KitabooSDK renderer view, is used to add bookmark icon to specific page.

Initiate BookMarkController (Objective C)

When user taps on bookmark icon, developerss will be able to receive a callback "didTapOnBookMark" with a parameter of tapped BookMarkView object, where developers need to initiate BookMarkController instance.

  • Create an instance of BookMarkController
  • Set your delegate to bookmark delegate property.
  • A method "setBookmarkVO" exposed by BookMarkController which allows the developers to add bookmark data on BookMarkController view.

Code snippet for Initializing BookMarkView:

BookMarkView *_bookMarkView = [[BookMarkView alloc] init];

[_bookMarkView setPageNumber:[NSNumber numberWithInteger:5]];

[_bookMarkView setDelegate:self];

[rendererViewController addBookmarkView:_bookMarkView onPageNO:5];

[_bookMarkView setBookmarkColorforNormalState:[UIColor grayColor]];

[_bookMarkView setBookmarkColorforSelectedState:[UIColor blueColor]];    
Parameter Name Description
pageNumber

NSNumber

Page Number; where bookmark is to be added.
delegate

BookMarkViewDelegate

A callback listener, BookMarkView object must adopt the BookMarkViewDelegate protocol.

Customisations

Below are some customisations that a developers can perform on BookmarkView:

  • To change the icon of both normal and selected bookmark on page.
    • Example Code snippet:
        [[BookMarkView alloc] initWithBookmarkIcon:bookmarkIcon WithSelectedBookmarkIcon:selectedBookmarkIcon]
  • To set the position of the bookmark icon on page
    • Example Code snippet:
        [_bookmarkView setPositionforParentFrame:self.view.bounds];
  • To set the background color of bookmark icon in normal state
    • Example Code snippet:
        [_bookMarkView setBookmarkColorforNormalState:[UIColor darkGrayColor]];
  • To set the background color of bookmark icon in selected state
    • Example Code snippet:
        [_bookMarkView setBookmarkColorforSelectedState:[UIColor darkGrayColor]];

Code snippet for Initializing BookMarkController:

BookMarkController *_bookMarkController = [[BookMarkController alloc]       initWithNibName:@"BookMarkController"
bundle:[NSBundle bundleforClass:[BookMarkController class]]];
_bookMarkController.delegate = self;
_bookMarkController.modalPresentationStyle = UIModalPresentationPopover;
_bookMarkController.preferredContentSize = CGSizeMake(320, 50);
[self presentViewController:_bookMarkController animated:YES completion:nil];

Code snippet for adding bookmark data on BookMarkController:

[_bookMarkController setBookmarkVO:[rendererViewController
 getBookmarkVOforPageNo:[_bookMarkView.pageNumber integerValue]]];

Below are some customisations that developers can perform on BookMarkController:

  • To set the background color of Bookmark's Popover
    • Example Code snippet:
        [_bookmarkController setBackgroundColorforView:@"FF0000"];
  • To set the tint color of input field
    • Example Code snippet:
        [_bookmarkController setTextFieldTintColor:[UIColor blueColor]];

Table of contents

KitabooSDK exposes a component, TOC, which shows the contents of a Book in the form of sections. The TOC contains three sections for Content, Resources, and Bookmark Respectively. Users can find the list structure of Book content (Index) in Content Section, created bookmark list in Bookmark Section and resources list in Resources Section. By clicking on list items, a callback method of TOCControllerDelegate is triggered, which has information about the page where the user wants to navigate.

Class: TOCController

The TOCController class is responsible for displaying data on TOC sections.

Protocol: TOCControllerDelegate

The TOCControllerDelegate protocol defines methods that allow users to perform actions when any segment is tapped i.e. content, resources and bookmark or any data row from the segment. When configuring the TOCController object, assign your delegate object to its delegate property.

Usage: TOCController

Initiate TOCController(Objective C)

  • Create an instance of TOCController by passing the parameter as given below in the code snippet.
  • It returns a newly allocated TOCController object with specified parameters.
  • Set your delegate to TOC controller delegate property.

Code snippet for Initializing TOCController:

TOCController *_tocController = [[TOCController alloc] initWithNibName:@"TOCController"
                                                     bundle:[NSBundle bundleforClass:[TOCController class]]];
_tocController.delegate = self;
KitabooBookVO *currentBook;
[_tocController setData:[currentBook getBookContentforTOC]];
[self presentViewController:_tocController animated:YES];
Parameter Name Description
delegate

TOCControllerDelegate

A callback listener, TOCController object must adopt the TOCControllerDelegate protocol.
data

NSArray

TOC Data, which is to be shown on TOC Sections.
  • KitabooSDK provides a class, KitabooBookVO, which exposes methods to get toc data.
  • To get content section data, "getBookContentforTOC", will be called.
  • To get resources section data, "getBookResourcesforTOC", will be called.

Customisations

Below are some customisations that developers can perform on TOCController:

  • To set the background color of TOCController's view
    • Example Code snippet:
        [_tocController setBackgroundColorforView:@"FF0000"];
  • To set the theme color for components like tint color of segment controller and TOC title label
    • Example Code snippet:
        [_tocController setThemeColorToView:[UIColor blueColor]];
  • To set the color to data inside table of TOCController
    • Example Code snippet:
        [_tocController setColorToDataInsideTable:[UIColor blueColor]];
  • To set the color to back button present for mobile device(iPhone)
    • Example Code snippet:
        [_tocController setBackButtonColor:[UIColor blueColor]];
  • To enable or disable title shown on mobile device(iPhone)
    • Example Code snippet:
        [_tocController enableTitle:YES];

My Data

MyData is a feature supported by KitabooSDK which helps to display User Generated Content (Contextual/ Sticky Note and highlights), MyData contains two sections for Notes and Highlights respectively. Users can find the created note list in Notes Section, and created highlight list in Highlights Section. Every Section further contains three sections for important Highlight/Notes, shared Highlights/Notes and non-shared Highlights/Notes, However, MyDataController exposes methods to enable/disable some features. Refer Class Details for supported methods.

By clicking on list items, a callback method of MyDataControllerDelegate is triggered, which has information about the page where user wants to navigate.

Class: MyDataViewController

The MyDataViewController class is responsible for displaying data on MyData sections.

Protocol: MyDataControllerDelegate

The MyDataControllerDelegate protocol defines methods that allow users to perform an action when any segment is tapped i.e. Highlights and notes or any data row from the segment is tapped by the user. All Delegate methods are optional. When configuring the MyDataViewController object, assign your delegate object to its delegate property.

Usage: MyDataViewController

Initiate MyDataViewController(Objective C)

  • Create an instance of MyDataViewController by passing the parameter as given below in the code snippet.
  • It returns a newly allocated MyDataViewController object with specified parameters.
  • Set your delegate to my data controller delegate property.

Code snippet for Initializing MyDataViewController:

MyDataViewController *_myDataViewController = [[MyDataViewController alloc] initWithNibName:@"MyDataViewController"
                                                               bundle:[NSBundle bundleforClass:[MyDataViewController class]]];
_myDataViewController.delegate = self;
HSDBManager *_dbManager = [[HSDBManager alloc] init];
KitabooUser *_user;
NSArray *myDataArray = [_dbManager highlightBookID:4 userID:[NSNumber numberWithInt:_user.userID.intValue]];
[_myDataViewController setData:myDataArray];
[self presentViewController:_myDataViewController animated:YES completion:nil];
Parameter Name Description
delegate

MyDataControllerDelegate

A callback listener, MyDataViewController object must adopt the MyDataControllerDelegate protocol.
data

NSArray

MyData Data, which is to be shown on MyData Sections.

Customisations

Below are some customisations that developers can perform on MyDataViewController:

  • To set the background color of MyDataViewController's view
    • Example Code snippet:
        [_myDataViewController setBackgroundColorforView:@"FF0000"];
  • To set the theme color for components like tint color of segment controller, MyData title label,important button color , MyHighlights/MyNotes and shared with me label
    • Example Code snippet:
        [_myDataViewController  setThemeColorToView:[UIColor blueColor]];
  • To set text color of no data label
    • Example Code snippet:
        [_myDataViewController setNoDataLabelTextColor:[UIColor blueColor]];
  • To enable/disable the Comment in Note Segment
    • Example Code snippet:
        [_myDataViewController disableCommentsforNote:NO];
  • To enable/disable the Share in Note Segment
    • Example Code snippet:
        [_myDataViewController disableShareforNote:NO];
  • To set text color to the shared ugc
    • Example Code snippet:
        [_myDataViewController setColorforSharedUGC:@"#FF0000"];
  • To enable or disable title shown on mobile device(iPhone)
    • Example Code snippet:
        [_myDataViewController enableTitle:YES];

Database Management

KitabooSDK facilitates a local storage/database which exists within SDK and allows developerss to store, each type of data which KitabooSDK supports such as Highlight, Contextual note, Sticky note, Bookmark, Pen Tool etc. The Data is stored using Core Data (ORM), and uses Sqlite for persistent storage.

However, developerss can create their own storage/database which will not be a part of KitabooSDK.

Class: HSDBManager

"An Object that will be responsible for persisting the SDK Data."

HSDBManager is a manager class which is used to handle all the communication of data, with database such as saving highlight to database, deleting any highlight from the database, updating shared data to database etc.

Usage: HSDBManager

Initiate HSDBManager(Objective C)

HSDBManager *dbManager = [[HSDBManager alloc] init];                

Once you get the instance of "HSDBManager" you can perform required operations. for eg.

SDKHighlightVO *highlight;

[dbManager saveHighlight:highlight bookID:[NSNumber numberWithInteger:10] userID:[NSNumber numberWithInteger:20]];

Kitaboo Data Syncing Manager

Class: KitabooDataSyncingManager

"An Object that will be responsible for Data Syncing."

KitabooDataSyncingManager is a manager class which is used to handle all the synchronization of data. It behaves like an intermediate class between local database and server, such as in case of fetch UGC (User Generated Content), data is fetched from the server and saved in the database and in case of save UGC, data is fetched from database and saved on server.

Note

for Managing Local Storage, it use HSDBManager class

Protocol: KitabooDataSyncingManagerDelegate

The KitabooDataSyncingManagerDelegate protocol defines methods that allow users to perform actions when data is saved, fetched or synchronized successfully or failed. The methods of this protocol are all optional.

Usage: KitabooDataSyncingManager

Initiate KitabooDataSyncingManager(Objective C)

  • Create an instance of KitabooDataSyncingManager by passing the parameter as given below in the code snippet.
  • It returns a newly allocated KitabooDataSyncingManager object with specified parameters.

Code snippet for Initializing KitabooDataSyncingManager:

KitabooDataSyncingManager *dataSyncManager = [[KitabooDataSyncingManager alloc] initWithBaseURLString:@"" clientID:@""];
Parameter Name Description
urlString

String

Base URL String Path.
clientID

String

Client ID.

Note

[dataSyncManager synchUGCforBookID:[NSNumber numberWithInteger:10] forUserID:[NSNumber numberWithInt:20] WithDelegate:self WithUserToken:@""];

Reflowable ePub Layout Setting Interface(GUI)

KitabooSDK exposes a component which provides an Interface (GUI); to update the Reflowable ePub layout.

Class: HDReflowableLayoutSettingController

"An Object that manage a view for Reflowable Layout Settings."

The HDReflowableLayoutSettingController class defines a Layout Setting GUI, where users can change the Font Size, Reader Mode, Text Alignment, Brightness, Margin, Line spacing for EPub Reflowable books.

Usage: HDReflowableLayoutSettingController

Initiate HDReflowableLayoutSettingController(Objective C)

  • Create an instance of HDReflowableLayoutSettingController by passing the parameter as given below in the code snippet.
  • It returns a newly allocated HDReflowableLayoutSettingController object with specified parameters.

Code snippet for Initializing HDReflowableLayoutSettingController:

HDReflowableLayoutSettingController * reflowableLayoutSettingController = [[HDReflowableLayoutSettingController alloc] init];
    reflowableLayoutSettingController.modalPresentationStyle = UIModalPresentationOverCurrentContext;
[self presentViewController:reflowableLayoutSettingController animated:NO completion:nil];

Code snippet for updating HDReflowableLayoutSettingController view:

[reflowableLayoutController setReaderModeEnable:YES];
[reflowableLayoutController setCurrentBrightness:[UIScreen mainScreen].brightness];
[reflowableLayoutController setFontSize:MEDIUM_FONT];
[reflowableLayoutController setPaginationEnable:YES];
[reflowableLayoutController setCurrentTextAlignment:LEFT_ALIGNMENT];
[reflowableLayoutController setCurrentLineSpacing:MEDIUM_LINESPACING];
[reflowableLayoutController setCurrentMargin:MEDIUM_MARGIN];

Code snippet for updating content :

  • developers has to implement blocks of HDReflowableLayoutSetingController, in which he can give calls to renderer methods for updating content.
    [reflowableLayoutController setFontFamilyDidChange:^(NSString *selectedFont)
    {
        [weakRendererView setFontFamily:selectedFont];
    }];

    [reflowableLayoutController setFontSizeDidChange:^(CGFloat fontSize)
    {
             [weakRendererView didFontSizeChanged:fontSize];
    }];

    [reflowableLayoutController setBrightnessDidChange:^(CGFloat brightnesValue)
     {
              [weakRendererView setBrightnessforReflowable:brightnesValue];
    }];

    [reflowableLayoutController setDidEnablePagination:^(BOOL isEnabled)
    {
          [weakRendererView enablePagination:isEnabled];
    }];

    [reflowableLayoutController setDidChangeReaderMode:^(READER_MODE readerModeType)
    {
              [weakRendererView setReaderMode:readerModeType];
    }];

    [reflowableLayoutController setDidChangeTextAliginment:^(TEXT_ALIGNMENT textAlignmentType)
    {
               [weakRendererView setTextAlignment:textAlignmentType];
    }];

    [reflowableLayoutController setDidChangeLineSpacing:^(NSInteger lineSpacingTypeValue)
    {
            [weakRendererView setLineSpacing:lineSpacingTypeValue];
    }];

    [reflowableLayoutController setDidChangeMargin:^(NSInteger marginTypeValue)
    {
            [weakRendererView setMargin:marginTypeValue];
    }

Note

weakRendererView is an object of type RendererViewController

Parameter Name Description
readerMode

READRE_MODE

With the help of Reader mode Feature, user, can change the appearance of Page to day mode, sepia mode or night mode.
brightness

CGFloat

Current brightness configuration for reflowable ePub books.
fontSize

NSInteger

Set font size to text for whole page of reflowable ePub books.
pagination

BOOL

Pagination is the process of dividing a document into discrete pages, where page navigation direction is either from left to right or vertical scrolling.
  • If enabled value is YES, page navigation direction will be left to right or in case of NO it will be vertical scrolling.
textAlignment

TEXT_ALIGNMENT

Text alignment is a feature that allows users to align text on a page, whether left, center, right or justify alignment.
lineSpacingTypeValue

TEXT_LINESPACING

To Set Line Spacing for Reflowable Epub books., whether it is a small, medium or large line spacing .
marginTypeValue

READER_MARGIN

To Set Margin for Reflowable Epub books., whether it is a small, medium or large Margin .

Customisations

Below are some customisations that developers can perform on ReflowableLayoutSettingController:

  • To set background color to HDReflowableLayoutController view.
    • Example Code snippet:
        [reflowableLayoutController setBackgroundColorforView:@"#4aaf7c"];
  • To set the font size to text for whole Page of reflowable ePub books.
    • Example Code snippet:
        [reflowableLayoutController setFontSize:3];
  • To set current Reader mode configuration for reflowable ePub books.
    • Example Code snippet:
        [reflowableLayoutController setReaderModeEnable:DAY_MODE];
  • To enable/disable the pagination configuration for reflowable ePub books.
    • Example Code snippet:
        [reflowableLayoutController setPaginationEnable:YES];
  • To set text alignment configuration for reflowable ePub books.
    • Example Code snippet:
        [reflowableLayoutController setCurrentTextAlignment: LEFT_ALIGNMENT];
  • To set current brightness configuration for reflowable ePub books.
    • Example Code snippet:
        [reflowableLayoutController setCurrentBrightness:[UIScreen mainScreen] .brightness];
  • To set current font family configuration for reflowable ePub books.
    • Example Code snippet:
        [reflowableLayoutController setCurrentFontFamily:@"Times New Roman"];
  • To set current line spacing configuration for reflowable epub books.
    • Example Code snippet:
        [reflowableLayoutController setCurrentLineSpacing:MEDIUM_LINESPACING];
  • To set current Margin configuration for reflowable epub books.
    • Example Code snippet:
        [reflowableLayoutController setCurrentMargin:MEDIUM_MARGIN];

HDWebPlayer

"KitabooSDK exposes a component to load an absolute URL."

Class: HDWebPlayer

The HDWebPlayer is responsible for Loading URL, which uses Kitaboo Defined UI for look and feel.

Protocol: HDWebPlayerDelegate

The HDWebPlayerDelegate protocol defines methods that allow users to perform actions when web player is closed or fails to load URL. All the methods of HDWebPlayerDelegate protocol are optional.

Usage: HDWebPlayer

Initiate HDWebPlayer(Objective C)

  • Create an instance of HDWebPlayer by passing the parameter as given below in the code snippet.
  • It returns a newly allocated HDWebPlayer object with specified parameters.

Code snippet for Initializing HDWebPlayer:

 HDWebPlayer * webPlayer = [[HDWebPlayer alloc] initWithHTMLPathURL: [NSURL URLWithString: @"https://www.google.com" ]];
 webPlayer.delegate = self;
 [self addChildViewController:webPlayer];
    [self.view addSubview:webPlayer.view];
    webPlayer.view.frame = self.view.bounds;
Parameter Name Description
pathURL

NSURL

Is the absolute HTML Path URL to be loaded in webview.
delegate

HDWebPlayerDelegate

A callback listener, HDWebPlayer object must adopt the HDWebPlayerDelegate protocol.

Audio Syncing

"KitabooSDK exposes a component to manage audio sync."

Class: AudioSyncController

Audio synchronization is responsible for handling links of Type AudioSync. AudioSync is a feature which enables user to read (Play Audio) each page content. Currently this is only supported for Kitaboo Fixed Book.

Protocol: AudioSyncControllerDelegate

A protocol that allows a delegate to respond when an audio sync stopped, started or when an audio sync has finished. The delegate of an AudioSyncController object must adopt the AudioSyncControllerDelegate protocol. All the methods of this protocol are optional.

Usage: AudioSyncController

Initiate AudioSyncController (Objective C)

  • Create an instance of AudioSyncController by passing the parameter as given below in the code snippet.
  • It returns a newly allocated AudioSyncController object with specified parameters.

Code snippet for Initializing AudioSyncController:

KFBookVO *book;
KFLinkVO *linkVO;
AudioSyncController *_audioSyncController=[[AudioSyncController alloc] initWithLinks:@[linkVO]  WithDelegate:self  WithBook:book WithPlayerUIEnable:YES];
[rendererViewController.view setUserInteractionEnabled:NO];
[_audioSyncController start];
UIView *_playerView = [_audioSyncController getPlayerView];
[self.view addSubview:_playerView];
Parameter Name Description
linkVO

NSArray

Array of Object of KFLinkVO for which Audio Sync is available. (Currently works with Only One Link in Links Array)
delegate

AudioSyncControllerDelegate

A callback listener, AudioSyncController object must adopt the AudioSyncControllerDelegate protocol.
book

KFBookVO

Book object for links.
playerUIEnable

BOOL

If YES then default UI will be available, else the developers can use customized UI and use the available methods to control the behaviour.

Kitaboo Audio Player

"KitabooSDK exposes a component to manage an audio player."

Class: KitabooAudioPlayer

The KitabooAudioPlayer class defines a Player to play an Audio sound. The KitabooAudioPlayer class lets you play sound in any audio format. You implement a delegate to handle, when a sound stops playing or to update the user interface, when a sound has finished playing. To start and stop an audio player, call one of its methods.

Protocol: AudioPlayerDelegate

A protocol that allows a delegate to respond when an audio sound stops playing, starts playing or when a sound has finished playing. The delegate of a KitabooAudioPlayer object must adopt the AudioPlayerDelegate protocol.

Usage: KitabooAudioPlayer

Initiate KitabooAudioPlayer(Objective C)

  • Create an instance of KitabooAudioPlayer by passing the parameter as given below in the code snippet.
  • It returns a newly allocated KitabooAudioPlayer object with specified parameters.

Code snippet for Initializing KitabooAudioPlayer:

KFBookVO *book;
KFLinkVO *linkVO;
KitabooAudioPlayer *_audioPlayer = [[KitabooAudioPlayer alloc] initWithURL:linkVO.url withBookPath:book.path withISBN:book.ISBN WithPlayerUIEnable:YES withIsEncrypted:YES];
 _audioPlayer.delegate=self;
[rendererViewController.view setUserInteractionEnabled:NO];
 [_audioPlayer start];
UIView *_playerView = [_audioPlayer getPlayerView];
_playerView.center = self.view.center;
[self.view addSubview:_playerView];
Parameter Name Description
url

NSString

Audio URL.
bookPath

NSString

Book path.
ISBN

NSString

Book ISBN Number.
playerUIEnable

BOOL

If YES, then default UI will be available, else the developers can use customized UI, and use the available methods to control the behaviour.
isEncrypted

BOOL

Audio URL is encrypted or decrypted.
delegate

AudioPlayerDelegate

A callback listener, KitabooAudioPlayer object must adopt the AudioPlayerDelegate protocol.

Kitaboo Document Player

"KitabooSDK exposes a component to manage a Player to open a document."

Class: KitabooDocumentPlayer

The KitabooDocumentPlayer class lets you open a document on a web player, With added features like Print Document, you can implement a delegate to handle, when the document player closes.

Protocol: KitabooDocumentPlayerDelegate

A protocol that allows a delegate to respond when document player closed. The delegate of a KitabooDocumentPlayer object must adopt the KitabooDocumentPlayerDelegate protocol. All the methods of this protocol are optional.

Usage: KitabooDocumentPlayer

Initiate KitabooDocumentPlayer(Objective C)

  • Create an instance of KitabooDocumentPlayer by passing the parameter.
  • It returns a newly allocated KitabooDocumentPlayer object with specified parameters.

Code snippet for Initializing KitabooDocumentPlayer:

NSURL *url;
KitabooDocumentPlayer *documentPlayer = [[ KitabooDocumentPlayer alloc ]  initWithURL: url];
documentPlayer.delegate = self;
[self addChildViewController:documentPlayer];
[self.view addSubview:documentPlayer.view];
documentPlayer.view.frame = self.view.bounds;
Parameter Name Description
url

NSURL

Is the NSURL to be loaded.
delegate

KitabooDocumentPlayerDelegate

A callback listener, KitabooDocumentPlayer object must adopt the KitabooDocumentPlayerDelegate protocol.

Kitaboo Image Controller

"KitabooSDK exposes a component to manage a view to open an image."

Class: KitabooImageController

The KitabooImageController class lets user to open an image or multiple images, in a separate view. You implement a delegate to handle, when image loading view is closed or image loading is failed.

Protocol: KitabooImageControllerDelegate

A protocol that allows a delegate to respond when image loading view is closed or image loading is failed.The delegate of a KitabooImageController object must adopt the KitabooImageControllerDelegate protocol.

Usage: KitabooImageController

Initiate KitabooImageController(Objective C)

  • Create an instance of KitabooImageController by passing the parameters as given below in the code snippet.
  • It returns a newly allocated KitabooImageController object with specified parameters.

Code snippet for Initializing KitabooImageController:

NSMutableArray *imageURLs;
NSMutableArray *imageProperties;
KFBookVO *book;
KitabooImageController  * _kitabooImageController=[[KitabooImageController alloc] initWithImageURLs:imageURLs withProperties:imageProperties withISBN:book.ISBN isEncrypted:YES isZoomable:NO WithDelegate:self];
[self addChildViewController:_kitabooImageController];
[self.view addSubview:_kitabooImageController.view];
Parameter Name Description
imageURLs

NSArray

Array of imagesURLs.
imageProperties

NSArray

Array of property of image.
bookISBN

NSString

ISBN of Book.
isEncrypted

BOOL

Encryption status of imagePath.
isZoomable

BOOL

Zoom feature of image.
delegate

KitabooImageControllerDelegate

A callback listener, KitabooImageController object must adopt the KitabooImageControllerDelegate protocol.

Kitaboo Video Player

"KitabooSDK exposes a component to manage a video Player."

Class: KitabooVideoPlayer

The KitabooVideoPlayer class defines a Player to play a Video. You implement a delegate to handle, when a video stops playing or to update the user interface, when a video has finished playing.

Protocol: KitabooVideoPlayerDelegate

A protocol that allows a delegate to respond when a video stops playing, is paused, playing or when a video has finished playing. The delegate of a KitabooVideoPlayer object must adopt the KitabooVideoPlayerDelegate protocol.

Usage: KitabooVideoPlayer

Initiate KitabooVideoPlayer(Objective C)

  • Create an instance of KitabooVideoPlayer by passing the parameters.
  • It returns a newly allocated KitabooVideoPlayer object with specified parameters.

Code snippet for Initializing KitabooVideoPlayer:

KFBookVO *book;
NSString *videoURL;
KFLinkVO *linkVO;
KitabooVideoPlayer *videoPlayer = [[KitabooVideoPlayer alloc]  initWithVideoPath: [videoURL absoluteString] withBookVO: book withLinkVO: linkVO];
videoPlayer.delegate = self;
videoPlayer.view.frame = self.view.bounds;
[self addChildViewController:videoPlayer];
[self.view addSubview:videoPlayer.view];
[videoPlayer playVideo];
Parameter Name Description
videoURL

NSString

Is the location of video in library.
bookVO

KFBookVO

Is the KFBookVO object.
linkVO

KFLinkVO

Is the KFLinkVO object.
delegate

KitabooVideoPlayerDelegate

A callback listener, KitabooVideoPlayer object must adopt the KitabooVideoPlayerDelegate protocol.

Kitaboo Web Player

Class: KitabooWebPlayer

The KitabooWebPlayer is responsible for Loading URL.

Protocol: KitabooWebPlayerDelegate

The KitabooWebPlayerDelegate protocol defines methods that allow users to perform actions when web player is closed or fails to load url. All the methods of KitabooWebPlayerDelegate protocol are optional. When configuring the KitabooWebPlayer object, assign your delegate object to its delegate property.

Usage: KitabooWebPlayer

Initiate KitabooWebPlayer(Objective C)

  • Create an instance of KitabooWebPlayer by passing the parameter as given below in the code snippet.
  • It returns a newly allocated KitabooWebPlayer object with specified parameters.

Code snippet for Initializing KitabooWebPlayer:

KFBookVO *book;
KFLinkVO *linkVO;
NSURL *path;
KitabooWebPlayer *webPlayer = [[KitabooWebPlayer alloc] initWithURL:path withLinkVO:linkVO WithBook:book];    
webPlayer.delegate = self;
[self addChildViewController:webPlayer];
[self.view addSubview:webPlayer.view];
webPlayer.view.frame = self.view.bounds;
Parameter Name Description
pathURL

NSURL

Is the Path URL to be loaded.
linkVO

KFLinkVO

Is the KFLinkVO object.
bookVO

KFBookVO

Is the KFBookVO object.
delegate

KitabooWebPlayerDelegate

A callback listener, KitabooWebPlayer object must adopt the KitabooWebPlayerDelegate protocol.

Kitaboo YouTube Player

"KitabooSDK exposes a component to handle Youtube videos."

Class: KitabooYTPlayer

The KitabooYTPlayer class defines a Player to play a YouTube Video. You can implement a delegate to handle, when YouTube player is closed.

Protocol: KitabooYTPlayerDelegate

A protocol that allows a delegate to respond when a YouTube video player is closed. The delegate of a KitabooYTPlayer object must adopt the KitabooYTPlayerDelegate protocol. All the methods of this protocol are optional.

Usage: KitabooYTPlayer

Initiate KitabooYTPlayer(Objective C)

  • Create an instance of KitabooYTPlayer by passing the parameters.
  • It returns a newly allocated KitabooYTPlayer object with specified parameters.

Code snippet for Initializing KitabooYTPlayer:

KFLinkVO *linkVO;
KitabooYTPlayer *_youtubePlayer = [[KitabooYTPlayer alloc] initWithLinkVO:linkVo];
_youtubePlayer.delegate=self;
[self addChildViewController:_youtubePlayer];
[self.view addSubview:_youtubePlayer.view];
_youtubePlayer.view.translatesAutoresizingMaskIntoConstraints=NO;

[self.view addConstraint:[NSLayoutConstraint constraintWithItem:_youtubePlayer.view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:_youtubePlayer.view attribute:NSLayoutAttributeBottom  relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:_youtubePlayer.view attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0]];
 [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_youtubePlayer.view attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]];
Parameter Name Description
linkVO

KFLinkVO

Is the KFLinkVO object.
delegate

KitabooYTPlayerDelegate

A callback listener, KitabooYTPlayer object must adopt the KitabooYTPlayerDelegate protocol.

Share Settings Controller

"KitabooSDK exposes a component to manage a view for sharing a note."

Class: ShareSettingController

ShareSettingsController defines a view, which appears when the user taps on share button of note controller. It opens a setting panel which contains information such as, To which teacher or student, user wants to share his/her notes.

Protocol: ShareSettingControllerDelegate

All delegate methods are optional. ShareSettingsControllerDelegate method gets called when the user selects any one of the buttons (Cancel, Save) available on the share settings controller. When configuring the ShareSettingsController object, assign your delegate object to its delegate property.

Usage: ShareSettingController

Initiate ShareSettingController(Objective C)

  • Create an instance of ShareSettingController by passing the parameters.
  • It returns a newly allocated ShareSettingController object with specified parameters.

Code snippet for Initializing ShareSettingController:

ShareSettingsController   *_shareSettingsController = [[ShareSettingsController alloc] initWithNibName:@"ShareSettingsController" bundle:[NSBundle bundleforClass:[ShareSettingsController class]]];
 _shareSettingsController.delegate = self;
SDKHighlightVO *highlight;
_shareSettingsController.highlightVO = highlight;
NSArray *classList;
[_shareSettingsController setData:classList];    
[_noteController.view addSubview:_shareSettingsController.view];
[_noteController addChildViewController:_shareSettingsController];    
_shareSettingsController.view.translatesAutoresizingMaskIntoConstraints =NO;

[_noteController.view addConstraint:[NSLayoutConstraint constraintWithItem:_shareSettingsController.view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_noteController.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0]];
[_noteController.view addConstraint:[NSLayoutConstraint constraintWithItem:_shareSettingsController.view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:_noteController.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]];
[_noteController.view addConstraint:[NSLayoutConstraint constraintWithItem:_shareSettingsController.view attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:_noteController.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0]];
[_noteController.view addConstraint:[NSLayoutConstraint constraintWithItem:_shareSettingsController.view attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:_noteController.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]];

Note

noteController Object of type HSNoteController

Parameter Name Description
highlight

SDKHighlightVO

Highlight is an object of type SDKHighlightVO. To open note controller highlight is mandatory.
data

NSArray

User should set the necessary data for displaying the data/content.
delegate

ShareSettingControllerDelegate

A callback listener, ShareSettingController object must adopt the ShareSettingControllerDelegate protocol.

Markup

Class: MarkupView

MarkupView is used to Manage the look and feel of links available on pages, it is reponsible for handling action. When a user selects the Markup, MarkupView is extended from UIButton, So to add action, UIButton standards need to be followed. The MarkupView contains information about position, linkID and pageID that needs to draw markup.

Usage: MarkupView

Initiate MarkupView(Objective C)

  • Create an instance of MarkupView by passing the parameters.
  • It returns a newly allocated MarkupView object with specified parameters.

Code snippet for Initializing MarkupView:

KFLinkVO *multiLink=[[KFLinkVO alloc]init];
multiLink.iconView=[[MarkupView alloc]init];
multiLink.iconView.pageID=number.integerValue;
multiLink.iconView.xCordinate = link.xCoordinate;
multiLink.iconView.yCordinate = link.yCoordinate;
multiLink.iconView.layer.borderWidth = 3.0;
multiLink.iconView.layer.cornerRadius=multiLink.transformedRect.size.width/2;
[multiLink.iconView.titleLabel setTextAlignment:NSTextAlignmentCenter];
[multiLink.iconView setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

Event Tracking

"An object that manage analytics."

Class: AnalyticsManager

The AnalyticsManager class is responsible for keeping track of analytics data for page, note, highlight and link

Usage: AnalyticsManager

Code snippet for Initializing AnalyticsManager:

[AnalyticsManager getInstance];

Note

Returns Singleton instance of AnalyticsManager

Class: KitabooAnalyticsAdapter

The KitabooAnalyticsAdapter class is responsible to convert the data of AnalyticsManager to specific json format which is required for Kitaboo

Usage: KitabooAnalyticsAdapter

Code snippet for Initializing KitabooAnalyticesAdapter & how KitabooAnalyticesAdapter convert the data of AnalyticsManager to specific json :

KitabooAnalyticsAdapter *analyticsAdapter = [[KitabooAnalyticsAdapter alloc] init];
NSString *kitabooAnalyticsData = [analyticsAdapter getAnalyticsData:[[AnalyticsManager getInstance] getTrackingJSON]];

"getAnalyticsData" is a method which is used to get analytics data such as how many pages have been swiped, how much was time spent on each page, notes created, deleted, updated, shared or recieved and normal or important highlights created or deleted or any link opened. It takes JSON String of Events(Use Analytics Manager to get analytics JSON), and Returns Kitaboo Reader Analytics JSON String.

Reading Time Manager

"An object that manages reading time"

Class: ReadingTimeManager

An Object that will be responsible to represent remaining time to completely read a book.

Usage: ReadingTimeManager

Initiate ReadingTimeManager(Objective C)

  • Create an instance of ReadingTimeManager by passing the parameters.
  • It returns a newly allocated ReadingTimeManager object with specified parameters.

Code Snippet For Initializing ReadingTimeManager:

KitabooBookVO *currentBook;
EPUBBookVO *book = (EPUBBookVO*)currentBook;
 readingTimeManager = [[ReadingTimeManager alloc] initWithBookPath:book.absolutePath];

!!! Note: To set the default average time per page.

   [readingTimeManager setDefaultAverageTimePerPage:30];

Glossary

Class: GlossaryViewController

Glossaryviewcontroller is a class which will be responsible for loading/displaying content related to the selected glossary and gives callback when any item is selected so one can perform respective action.

GlossaryViewControllerDelegate:

GlossaryViewControllerDelegate Protocol is used to handle all the callbacks of GlossaryViewController Class.The GlossaryViewControllerDelegate protocol defines methods that allow user to manage all the actions/events when any Glossary Item is selected.

When configuring the GlossaryViewController object, assign your delegate object to its delegate property.

Usage: GlossaryViewController

Code Snippet For Initializing GlossaryViewController:

KitabooBookVO *currentBook;
GlossaryViewController *glossaryViewController = [[GlossaryViewController alloc] init];
[glossaryViewController setGlossaryItem:glossary];
glossaryViewController.view.backgroundColor = UIColor.whiteColor;
glossaryViewController.delegate = self;
glossaryViewController.modalPresentationStyle = UIModalPresentationPopover;
glossaryViewController.preferredContentSize = CGSizeMake(300, 300);
UIPopoverPresentationController *popoverpresentationController = [glossaryViewController popoverPresentationController];
popoverpresentationController.backgroundColor = UIColor.clearColor;
popoverpresentationController.delegate=self;
[self presentViewController:glossaryViewController animated:NO completion:nil];

It returns a newly allocated GlossaryViewController object with specified parameters.

Class: PrintPageViewController

An object that manages printing user interface. The shared instance of it represents a print job, printing page status. Responding to user interactions with Print Controller.

PrintPageViewControllerDelegate:

PrintPageViewControllerDelegate Protocol is used to handle all the callbacks of PrintPageViewController Class.The PrintPageViewControllerDelegate protocol defines a method that allow user to manage print task.

When configuring the PrintPageViewController object, assign your delegate object to its delegate property.

Usage: PrintPageViewController

Code Snippet For Initializing PrintPageViewController:

UIImage* pageImageToPrint = [rendererView getPageImageToPrintForPageNumber:2];
PrintPageViewController * printPageVC = [[PrintPageViewController alloc]initWithPrintImage:pageImageToPrint];
printPageVC.delegate = self;
[self.view addSubview: printPageVC.view]; printPageVC.view.translatesAutoresizingMaskIntoConstraints = false;
[printPageVC.view.leftAnchor constraintEqualToAnchor:self.view.leftAnchor constant:0].active = true;
[printPageVC.view.rightAnchor constraintEqualToAnchor:self.view.rightAnchor constant:0].active = true;
[printPageVC.view.topAnchor constraintEqualToAnchor:self.view.topAnchor constant:0].active = true;
[printPageVC.view.bottomAnchor constraintEqualToAnchor:self.view.bottomAnchor constant:0].active = true;

It returns a newly allocated PrintPageViewController object with specified parameters.

Class: PrintPageButton

A control that executes Print page controller code in response to user interactions.

PrintPageViewDelegate:

PrintPageViewDelegate Protocol is used to handle all the callbacks of PrintPageButton Class.The PrintPageViewDelegate protocol defines a method that allows the user to manage interactions.

When configuring the PrintPageButton object, assign your delegate object to its delegate property.

Usage: PrintPageButton

Code Snippet For Initializing PrintPageButton:

PrintPageButton *_printPageView = [[PrintPageButton alloc]init];
    [_printPageView setPageNumber:[NSNumber numberWithInteger:2]];
    _printPageView.delegate = self;
    [_printPageView setTitle:@ forState:UIControlStateNormal];
    [rendererView addPrintPageView:_printPageView onPageNO:[pageNo integerValue]];

Class: HDDropDownController

An object that manages the content of ShareSetting classes. A HDDropDownController object manages content of classes in dropdown list and selection of class from dropdown list.

HDDropDownDelegate:

Methods for managing selection of items in Dropdown of ShareSettings.

Usage: HDDropDownController

Code Snippet For Initializing HDDropDownController:

It returns a newly allocated HDDropDownController object with specified parameters.

   CGRect frameForDropDown;
   HDDropDownController * dropdowncontroller = [[HDDropDownController alloc] initWithDataArray:classArray dropDownFrame:CGRectMake(frameForDropDown.origin.x, frameForDropDown.origin.y+_classListHolderView.frame.size.height, frameForDropDown.size.width, 150)];
   dropdowncontroller.delegate = self;
    dropdowncontroller.view.layer.borderWidth = 1;
   dropdowncontroller.view.layer.borderColor = [themeColor CGColor];
   [self.view addSubview:dropdowncontroller.view];
   [self addChildViewController:dropdowncontroller];

Class: LinkDropDownViewController

An object that manages the content for links in Dropdown. A LinkDropDownViewController object manages the content of the link in the dropdown list and allows the selection of items from the dropdown list.

LinkDropDownViewControllerDelegate:

The delegate handles selections in this method. One of the things it can do is save the selected DropDown Text. This method will be called when the DropDown Item is Select.

Usage: LinkDropDownViewController

Code Snippet For Initializing LinkDropDownViewController:

It returns a newly allocated LinkDropDownViewController object with specified parameters.

LinkDropDownViewController *_linkDropDownController = [[LinkDropDownViewController alloc]initWithDropDownData: dropdownItems withDropDown:link.iconView];
        _linkDropDownController.delegate = self;
            _linkDropDownController.modalPresentationStyle = UIModalPresentationPopover;
            _linkDropDownController.preferredContentSize =  CGSizeMake(220, 220);
            UIPopoverPresentationController *popoverpresentationController = [_linkDropDownController popoverPresentationController];
            popoverpresentationController.backgroundColor = UIColor.blackColor;
            popoverpresentationController.delegate=self;
            popoverpresentationController.permittedArrowDirections = UIPopoverArrowDirectionAny;
            [self presentViewController:_linkDropDownController animated:NO completion:nil];

Protractor

Class: ProtractorViewController

An object that manages Protractor behaviour.

A ProtractorViewController's main responsibilities include the following: - Responding to user interactions with Protractor. - Resizing protractor view and managing the layout of the overall interface. - Coordinating with protractor web content data. - Updating the contents of the views, providing detailed data about the protractor.

ProtractorViewControllerDelegate:

ProtractorViewControllerDelegate Protocol used to handle all the callbacks of ProtractorViewController Class.The ProtractorViewControllerDelegate protocol defines method that allow user to manage clean-up and saving protractor data.

When configuring the Protractor View Controller object, assign your delegate object to its delegate property.

Usage: ProtractorViewController

Code Snippet For Initializing ProtractorViewController:

It returns a newly allocated ProtractorViewController object with specified parameters.

ProtractorViewController * protractorViewController=[[ProtractorViewController alloc] init];
        [protractorViewController setProtractorCanvasWithCanvas:(PenDrawingView*)[[rendererView getPenDrawingCanvas] objectAtIndex:0]];
        protractorViewController.delegate=self;
        [self addChildViewController:protractorViewController];
        [self.view addSubview:protractorViewController.view];

Class: ProtractorSelectionButton

A control that is used to handle Protractor selection. When you select a button that has focus, the button performs any actions attached to it.

Code Snippet For Initializing ProtractorSelectionButton:

ProtractorSelectionButton *protractorSelectButton = [[ProtractorSelectionButton alloc]initWithFrame:CGRectMake(0,0, 50, 50.0)];
            protractorSelectButton.penToolUUID = drawingObject.penToolUUID;
            protractorSelectButton.backgroundColor=[UIColor clearColor];
            protractorSelectButton.alpha=1.0;
            [self.view addSubview:protractorSelectButton];
            [self.view bringSubviewToFront:protractorSelectButton];

WaterMark

Class: WatermarkHolderView

A WatermarkHolderView object adds content within its bounds rectangle and handles any interactions with that content. Use WatermarkHolderView to add watermark, it can be a label, image etc.

Code Snippet For Initializing WatermarkHolderView:

It returns a newly allocated WatermarkHolderView object with specified parameters.

WatermarkHolderView *watermarkHolderView = [[WatermarkHolderView alloc]init];
    [watermarkHolderView setFrame:CGRectMake(0, 0, 200, 30)];
    [watermarkHolderView setWatermarkHolderViewPosition:WatermarkPositionBottomLeft];

    UILabel *watermark = [[UILabel alloc]init];
    watermark.text = @"watermark@test.com";
    [watermarkHolderView addSubview:watermark];
    watermark.translatesAutoresizingMaskIntoConstraints = false;
    [watermark.leftAnchor constraintEqualToAnchor:watermarkHolderView.leftAnchor constant:0].active = true;
    [watermark.topAnchor constraintEqualToAnchor:watermarkHolderView.topAnchor constant:0].active = true;
    [watermark.bottomAnchor constraintEqualToAnchor:watermarkHolderView.bottomAnchor constant:0].active = true;
    [watermark.rightAnchor constraintEqualToAnchor:watermarkHolderView.rightAnchor constant:0].active = true;
    [self->rendererView addWatermark:watermarkHolderView onPageNumber:[pageNumber integerValue]];

Audiobook

Class: HDKitabooAudioBookPlayerController

HDKitabooAudioBookPlayerController has the set of classes which consumes SDK Component and creates a fully functional controller for AudioBook, so that the AudioBooks can be Launched and predefined actions can be done, which includes Adding Bookmark, Updating narration speed of audio, TOC etc. A HDKitabooAudioBookPlayerController initializes all the components which are part of the AudioBook and handles all call backs of the components.

Code Snippet For Initializing HDKitabooAudioBookPlayerController:

It returns a newly allocated HDKitabooAudioBookPlayerController object with specified parameters.

let audioBookPlayerController = HDKitabooAudioBookPlayerController.init(audioBookPath,thumbnailURL)
audioBookPlayerController.delegate = self
self.present(audioBookPlayerController, animated: false, completion: nil)