PlugPDF SDK iOS Developer Guide

How can I hide the top bar and bottom bar?

PlugPDF provides the method that can hide the PlugPDF Viewer’s top bar and bottom bar.

The way to hide the PlugPDF Viewer’s top bar and bottom bar would be suitable for just PDF Viewer.

The method is for someone who does not want to use annotation features and bottom page slider.

If you do not want to use pdf editing functions, you can use the below codes.

You can hide and show the topbar and bottom bar.

 //the below code is for setting TopBar
[viewController setEnableTopBar:NO];
//the below code is for setting bottomBar
[viewController setEnableBottomBar:NO];

Moreover, you can add your own top bar instead of use PlugPDF Viewer.


How can I change the title of the top bar?

Usually, PlugPDFViewcontroller shows PDF’s title on the top navigation bar.

However, you can change the title with menuItemTitle property.

You also can change the title background and text color.

The below code snippet is for changing the title.

        PlugPDFviewController.menuItemTitle = [[UILabel alloc] initWithFrame: CGRectMake(0, 0, 100, 15)];
        [PlugPDFviewController.menuItemTitle setBackgroundColor: [UIColor greenColor]];
        [PlugPDFviewController.menuItemTitle setTextColor: [UIColor whiteColor]];
        [PlugPDFviewController.menuItemTitle setFont: [UIFont systemFontOfSize: 14.0]];
        [PlugPDFviewController.menuItemTitle setUserInteractionEnabled: NO];


Outline tool

The PlugPDF SDK provides the feature to change outline item.

Once the outline list is changed, a user cannot see the original outline list.

To prevent the issue, PlugPDF provides the property decides to enable or disable the outline editing.

[PlugPDFviewController setEnableOutlineEditable:NO];


How can I customize the menu items? 

You may do not want to use all of the menu items that PlugPDF provides.

Simply you can customize the menu item list with – (void)setMenuItems: (NSArray*)items;.

The below enum value is for the each menu item.

typedef NS_OPTIONS(NSUInteger, PlugPDFDocumentMenuItem) {
// PlugPDFDocumentNavigationBarModeView
PlugPDFDocumentMenuItemClose = 100, // Close
PlugPDFDocumentMenuItemRotateView = 101, // Rotate or lock view
PlugPDFDocumentMenuItemDisplayMode = 102, // Display mode
PlugPDFDocumentMenuItemBrightness = 103, // Brightness
PlugPDFDocumentMenuItemOutline = 104, // Show outline table
PlugPDFDocumentMenuItemSearch = 105, // Search keyword
PlugPDFDocumentMenuItemEdit = 106, // Edit
PlugPDFDocumentMenuItemSelectText = 107, // Select text
PlugPDFDocumentMenuItemOK = 108, // Check

// PlugPDFDocumentNavigationBarModeSearch
PlugPDFDocumentMenuItemBack = 200, // Back to normal
PlugPDFDocumentMenuItemSearchBackward = 201, // Search backward
PlugPDFDocumentMenuItemSearchForward = 202, // Search forward

// PlugPDFDocumentNavigationBarModeEdit
PlugPDFDocumentMenuItemNote = 301, // Note annotaion
PlugPDFDocumentMenuItemInk = 302, // Ink annotation
PlugPDFDocumentMenuItemEraser = 303, // Eraser tool
PlugPDFDocumentMenuItemTextHighlight = 304, // Text highlight
PlugPDFDocumentMenuItemTextUnderline = 305, // Text underline
PlugPDFDocumentMenuItemTextStrikeOut = 306, // Text strikeout

// PlugPDFDocumentOutlineBarModeEdit
PlugPDFDocumentMenuitemAdd = 401, // Add
PlugPDFDocumentMenuItemDelete = 402, // Delete
PlugPDFDocumentMenuItemDone = 403 // Done
};PlugPDFDocumentMenuitemAdd = 401, // Add
PlugPDFDocumentMenuItemDelete = 402, // Delete
PlugPDFDocumentMenuItemDone = 403 // Done
};

The below code snippet is the example for setting menu items. 

        [viewController setMenuItems: @[@102, @104, @105, @106, @107, @200, @201, @202, @301, @302, @303, @304, @305, @306]];


How can I add a button on the navigation bar? 

It is possible to add a button and customizing action on the navigation bar.

Not only you can add the button, you can also decide the position of the button whether left or right side.

First of all, you need to generate the UIBarButtonItem.

  UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemSave
                                                                                  target: self
                                                                                  action: @selector(barButtonItem:)];

Then, you need to decide to add the button position.

[viewController addLeftBarButtonItem: item];
//or right
// [viewController addRightBarButtonItem: item];

Also, you can add an action with barButtonItem:.

- (void)barButtonItem: (id)sender
{
}


How can I change the navigation bar background color?

The PlugPDF navigation color would not match with your mobile application theme color.

You can easily change the PlugPDF navigation color with – (void)setNavigationBarImage: (NSString*)path;.

The below code is the example for changing the navigation background color.

 [PlugPDFviewController setNavigationBarImage: [[NSBundle mainBundle] pathForResource:@"PlugPDFSDK" ofType:@"png"]];


How can I change the menu item’s background color?

The PlugPDF menu item color would not match with your mobile application theme color.

You can easily change the PlugPDF menu item color with – (void)setBarButtonItemBackgroundImage: (NSString*)path;.

The below code is the example for changing the menu item’s background color.

[PlugPDFviewController setBarButtonItemBackgroundImage: [[NSBundle mainBundle] pathForResource:@"plugpdfsdk" ofType:@"png"]];