Customize UI with configuration
Foxit PDF SDK for iOS supports JSON configuration to customize UI Extensions modules and settings. Pass the file when initializing UIExtensionsManager; the SDK enables or disables modules accordingly.
Load configuration file
objc
NSString *configPath = [[NSBundle mainBundle] pathForResource:@"uiextensions_config"
ofType:@"json"];
NSData *configData = [NSData dataWithContentsOfFile:configPath];
UIExtensionsManager *extensionsMgr = [[UIExtensionsManager alloc]
initWithPDFViewControl:pdfViewCtrl
configuration:configData];Configuration options
UIExtensionsConfig provides these module switches:
| Option | Description | Default |
|---|---|---|
loadThumbnail | Page thumbnails (delete/add/rotate pages) | YES |
loadReadingBookmark | Reading bookmarks | YES |
loadOutline | PDF outline | YES |
loadAttachment | Attachments | YES |
loadForm | Forms | YES |
loadSignature | Signatures | YES |
loadSearch | Text search | YES |
loadPageNavigation | Page navigation | YES |
loadEncryption | Password protection | YES |
runJavaScript | JavaScript | YES |
copyText | Allow copy text | YES |
disableLink | Disable hyperlink navigation | NO |
JSON format
Standard JSON example:
json
{
"modules": {
"thumbnail": true,
"readingBookmark": true,
"outline": true,
"attachment": true,
"signature": true,
"search": true,
"pageNavigation": true,
"form": true,
"encryption": true,
"javascript": true
},
"permissions": {
"copyText": true,
"disableLink": false
},
"uiSettings": {
"pageMode": "Single",
"continuous": true,
"colorMode": "Normal",
"zoomMode": "FitWidth",
"fullscreen": false,
"highlightForm": true,
"highlightLink": true
}
}Configure in code
You can also use a UIExtensionsConfig object:
objc
UIExtensionsConfig *config = [[UIExtensionsConfig alloc] initWithJSONData:nil];
config.loadThumbnail = YES;
config.loadOutline = YES;
config.loadForm = YES;
config.loadSignature = YES;
config.loadSearch = YES;
config.copyText = YES;
UIExtensionsManager *extensionsMgr = [[UIExtensionsManager alloc]
initWithPDFViewControl:pdfViewCtrl
configurationObject:config];API reference
See the API reference for UIExtensionsConfig and UIExtensionsManager.