openDestination property
int?
get
openDestination
The open destination (where document opens). Returns page number, or null if not set.
Implementation
int? get openDestination {
if (_parser == null) return null;
final rootObj = _parser!.getObject(_parser!.rootRef);
if (rootObj == null) return null;
// Check /OpenAction
final openMatch = RegExp(r'/OpenAction\s*\[?\s*(\d+)\s+\d+\s+R')
.firstMatch(rootObj.content);
if (openMatch != null) {
final pageRef = int.parse(openMatch.group(1)!);
for (var i = 0; i < pageInfos.length; i++) {
final obj = _parser!.getObject(pageRef);
if (obj != null && obj.content.contains('/Type /Page')) {
return i;
}
}
}
return null;
}