Commits

Anonymous committed f0c6e83

initial integration of PDFNet

Comments (0)

Files changed (10)

English.lproj/MyPDFDocWin.xib

 		<string key="IBDocument.AppKitVersion">1038.29</string>
 		<string key="IBDocument.HIToolboxVersion">461.00</string>
 		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
-			<bool key="EncodedWithXMLCoder">YES</bool>
-			<object class="NSArray" key="dict.sortedKeys">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-				<string>com.apple.pdfkit.ibplugin</string>
-			</object>
-			<object class="NSMutableArray" key="dict.values">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<string>740</string>
-				<string>1.1.0</string>
-			</object>
+			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
+			<string key="NS.object.0">740</string>
 		</object>
 		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
 			<bool key="EncodedWithXMLCoder">YES</bool>
 			<integer value="100049"/>
-			<integer value="100094"/>
 			<integer value="100067"/>
+			<integer value="6"/>
 		</object>
 		<object class="NSArray" key="IBDocument.PluginDependencies">
 			<bool key="EncodedWithXMLCoder">YES</bool>
 			<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-			<string>com.apple.pdfkit.ibplugin</string>
 		</object>
 		<object class="NSMutableDictionary" key="IBDocument.Metadata">
 			<bool key="EncodedWithXMLCoder">YES</bool>
 			<object class="NSWindowTemplate" id="275939982">
 				<int key="NSWindowStyleMask">15</int>
 				<int key="NSWindowBacking">2</int>
-				<string key="NSWindowRect">{{133, 279}, {566, 369}}</string>
+				<string key="NSWindowRect">{{133, 174}, {542, 474}}</string>
 				<int key="NSWTFlags">1886912512</int>
 				<string key="NSWindowTitle">Window</string>
 				<string key="NSWindowClass">NSWindow</string>
 								<string key="NSToolbarItemPaletteLabel">Page</string>
 								<nil key="NSToolbarItemToolTip"/>
 								<object class="NSTextField" key="NSToolbarItemView" id="378965257">
-									<reference key="NSNextResponder"/>
+									<nil key="NSNextResponder"/>
 									<int key="NSvFlags">268</int>
 									<string key="NSFrame">{{0, 14}, {58, 22}}</string>
-									<reference key="NSSuperview"/>
 									<bool key="NSEnabled">YES</bool>
 									<object class="NSTextFieldCell" key="NSCell" id="642681720">
 										<int key="NSCellFlags">-1804468671</int>
 								<string key="NSToolbarItemPaletteLabel">Zoom</string>
 								<nil key="NSToolbarItemToolTip"/>
 								<object class="NSSegmentedControl" key="NSToolbarItemView" id="767724378">
-									<reference key="NSNextResponder"/>
+									<nil key="NSNextResponder"/>
 									<int key="NSvFlags">268</int>
 									<string key="NSFrame">{{0, 14}, {71, 23}}</string>
-									<reference key="NSSuperview"/>
 									<bool key="NSEnabled">YES</bool>
 									<object class="NSSegmentedCell" key="NSCell" id="794374343">
 										<int key="NSCellFlags">67239424</int>
 								<string key="NSToolbarItemPaletteLabel">Previous/Next</string>
 								<nil key="NSToolbarItemToolTip"/>
 								<object class="NSSegmentedControl" key="NSToolbarItemView" id="515659035">
-									<reference key="NSNextResponder"/>
+									<nil key="NSNextResponder"/>
 									<int key="NSvFlags">268</int>
 									<string key="NSFrame">{{0, 14}, {95, 23}}</string>
-									<reference key="NSSuperview"/>
 									<int key="NSViewLayerContentsRedrawPolicy">2</int>
 									<bool key="NSEnabled">YES</bool>
 									<object class="NSSegmentedCell" key="NSCell" id="921600500">
 					<int key="NSvFlags">256</int>
 					<object class="NSMutableArray" key="NSSubviews">
 						<bool key="EncodedWithXMLCoder">YES</bool>
-						<object class="PDFView" id="169806030">
+						<object class="NSScrollView" id="214858758">
 							<reference key="NSNextResponder" ref="568628114"/>
-							<int key="NSvFlags">18</int>
-							<object class="NSMutableSet" key="NSDragTypes">
+							<int key="NSvFlags">274</int>
+							<object class="NSMutableArray" key="NSSubviews">
 								<bool key="EncodedWithXMLCoder">YES</bool>
-								<object class="NSArray" key="set.sortedObjects">
-									<bool key="EncodedWithXMLCoder">YES</bool>
-									<string>NSFilenamesPboardType</string>
+								<object class="NSClipView" id="825781563">
+									<reference key="NSNextResponder" ref="214858758"/>
+									<int key="NSvFlags">2304</int>
+									<object class="NSMutableArray" key="NSSubviews">
+										<bool key="EncodedWithXMLCoder">YES</bool>
+										<object class="NSCustomView" id="899448811">
+											<reference key="NSNextResponder" ref="825781563"/>
+											<int key="NSvFlags">274</int>
+											<string key="NSFrameSize">{527, 459}</string>
+											<reference key="NSSuperview" ref="825781563"/>
+											<string key="NSClassName">TronPDFView</string>
+										</object>
+									</object>
+									<string key="NSFrame">{{1, 1}, {527, 459}}</string>
+									<reference key="NSSuperview" ref="214858758"/>
+									<reference key="NSNextKeyView" ref="899448811"/>
+									<reference key="NSDocView" ref="899448811"/>
+									<object class="NSColor" key="NSBGColor" id="853711789">
+										<int key="NSColorSpace">6</int>
+										<string key="NSCatalogName">System</string>
+										<string key="NSColorName">controlColor</string>
+										<object class="NSColor" key="NSColor">
+											<int key="NSColorSpace">3</int>
+											<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
+										</object>
+									</object>
+									<int key="NScvFlags">4</int>
+								</object>
+								<object class="NSScroller" id="566806266">
+									<reference key="NSNextResponder" ref="214858758"/>
+									<int key="NSvFlags">256</int>
+									<string key="NSFrame">{{528, 1}, {15, 459}}</string>
+									<reference key="NSSuperview" ref="214858758"/>
+									<reference key="NSTarget" ref="214858758"/>
+									<string key="NSAction">_doScroller:</string>
+									<double key="NSCurValue">1</double>
+									<double key="NSPercent">0.96363627910614014</double>
+								</object>
+								<object class="NSScroller" id="845371420">
+									<reference key="NSNextResponder" ref="214858758"/>
+									<int key="NSvFlags">256</int>
+									<string key="NSFrame">{{1, 460}, {527, 15}}</string>
+									<reference key="NSSuperview" ref="214858758"/>
+									<int key="NSsFlags">1</int>
+									<reference key="NSTarget" ref="214858758"/>
+									<string key="NSAction">_doScroller:</string>
+									<double key="NSPercent">0.50602412223815918</double>
 								</object>
 							</object>
-							<string key="NSFrameSize">{566, 369}</string>
+							<string key="NSFrame">{{-1, -1}, {544, 476}}</string>
 							<reference key="NSSuperview" ref="568628114"/>
-							<int key="DisplayMode">1</int>
-							<bool key="PageBreaks">YES</bool>
-							<float key="ScaleFactor">1</float>
-							<bool key="AutoScale">NO</bool>
+							<reference key="NSNextKeyView" ref="825781563"/>
+							<int key="NSsFlags">50</int>
+							<reference key="NSVScroller" ref="566806266"/>
+							<reference key="NSHScroller" ref="845371420"/>
+							<reference key="NSContentView" ref="825781563"/>
 						</object>
 					</object>
-					<string key="NSFrameSize">{566, 369}</string>
+					<string key="NSFrameSize">{542, 474}</string>
 					<reference key="NSSuperview"/>
 					<int key="NSViewLayerContentsRedrawPolicy">2</int>
 				</object>
 								<string key="NSContents">Go to page (a to b):</string>
 								<reference key="NSSupport" ref="26"/>
 								<reference key="NSControlView" ref="886609703"/>
-								<object class="NSColor" key="NSBackgroundColor" id="853711789">
-									<int key="NSColorSpace">6</int>
-									<string key="NSCatalogName">System</string>
-									<string key="NSColorName">controlColor</string>
-									<object class="NSColor" key="NSColor">
-										<int key="NSColorSpace">3</int>
-										<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
-									</object>
-								</object>
+								<reference key="NSBackgroundColor" ref="853711789"/>
 								<object class="NSColor" key="NSTextColor" id="343509090">
 									<int key="NSColorSpace">6</int>
 									<string key="NSCatalogName">System</string>
 				</object>
 				<object class="IBConnectionRecord">
 					<object class="IBOutletConnection" key="connection">
-						<string key="label">_pdfView</string>
-						<reference key="source" ref="512844837"/>
-						<reference key="destination" ref="169806030"/>
-					</object>
-					<int key="connectionID">100046</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
 						<string key="label">_goToPagePanel</string>
 						<reference key="source" ref="512844837"/>
 						<reference key="destination" ref="628963359"/>
 				</object>
 				<object class="IBConnectionRecord">
 					<object class="IBOutletConnection" key="connection">
-						<string key="label">initialFirstResponder</string>
-						<reference key="source" ref="275939982"/>
-						<reference key="destination" ref="169806030"/>
-					</object>
-					<int key="connectionID">100066</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
 						<string key="label">_saveProgressPanel</string>
 						<reference key="source" ref="512844837"/>
 						<reference key="destination" ref="773158981"/>
 					</object>
 					<int key="connectionID">100107</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBOutletConnection" key="connection">
+						<string key="label">_pdfScrollView</string>
+						<reference key="source" ref="512844837"/>
+						<reference key="destination" ref="214858758"/>
+					</object>
+					<int key="connectionID">100139</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBOutletConnection" key="connection">
+						<string key="label">_tronPDFView</string>
+						<reference key="source" ref="512844837"/>
+						<reference key="destination" ref="899448811"/>
+					</object>
+					<int key="connectionID">100140</int>
+				</object>
 			</object>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<object class="NSArray" key="orderedObjects">
 						<reference key="object" ref="568628114"/>
 						<object class="NSMutableArray" key="children">
 							<bool key="EncodedWithXMLCoder">YES</bool>
-							<reference ref="169806030"/>
+							<reference ref="214858758"/>
 						</object>
 						<reference key="parent" ref="275939982"/>
 					</object>
 						<string key="objectName">Application</string>
 					</object>
 					<object class="IBObjectRecord">
-						<int key="objectID">100041</int>
-						<reference key="object" ref="169806030"/>
-						<reference key="parent" ref="568628114"/>
-					</object>
-					<object class="IBObjectRecord">
 						<int key="objectID">100048</int>
 						<reference key="object" ref="628963359"/>
 						<object class="NSMutableArray" key="children">
 						<reference key="object" ref="642681720"/>
 						<reference key="parent" ref="378965257"/>
 					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">100131</int>
+						<reference key="object" ref="214858758"/>
+						<object class="NSMutableArray" key="children">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<reference ref="566806266"/>
+							<reference ref="845371420"/>
+							<reference ref="899448811"/>
+						</object>
+						<reference key="parent" ref="568628114"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">100132</int>
+						<reference key="object" ref="566806266"/>
+						<reference key="parent" ref="214858758"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">100133</int>
+						<reference key="object" ref="845371420"/>
+						<reference key="parent" ref="214858758"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">100134</int>
+						<reference key="object" ref="899448811"/>
+						<reference key="parent" ref="214858758"/>
+					</object>
 				</object>
 			</object>
 			<object class="NSMutableDictionary" key="flattenedProperties">
 				<object class="NSArray" key="dict.sortedKeys">
 					<bool key="EncodedWithXMLCoder">YES</bool>
 					<string>-3.IBPluginDependency</string>
-					<string>100041.IBPluginDependency</string>
 					<string>100048.IBEditorWindowLastContentRect</string>
 					<string>100048.IBPluginDependency</string>
 					<string>100048.IBWindowTemplateEditedContentRect</string>
 					<string>100092.IBPluginDependency</string>
 					<string>100093.IBPluginDependency</string>
 					<string>100094.IBPluginDependency</string>
+					<string>100131.IBPluginDependency</string>
+					<string>100132.IBPluginDependency</string>
+					<string>100133.IBPluginDependency</string>
+					<string>100134.IBPluginDependency</string>
 					<string>5.IBEditorWindowLastContentRect</string>
 					<string>5.IBPluginDependency</string>
 					<string>5.IBWindowTemplateEditedContentRect</string>
 				<object class="NSMutableArray" key="dict.values">
 					<bool key="EncodedWithXMLCoder">YES</bool>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.pdfkit.ibplugin</string>
 					<string>{{552, 634}, {246, 105}}</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>{{552, 634}, {246, 105}}</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>{{344, 381}, {616, 227}}</string>
+					<string>{{344, 608}, {616, 0}}</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>{{369, 239}, {566, 369}}</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>{{369, 239}, {566, 369}}</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>{{402, 217}, {542, 474}}</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>{{402, 217}, {542, 474}}</string>
 					<integer value="1"/>
 					<string>{{201, 387}, {507, 413}}</string>
 					<integer value="1"/>
 				</object>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">100107</int>
+			<int key="maxID">100140</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
 							<string>_goToPagePanelPageLabel</string>
 							<string>_goTopagePanelRangeLabel</string>
 							<string>_pagesTextField</string>
-							<string>_pdfView</string>
+							<string>_pdfScrollView</string>
 							<string>_previousNextPageSegCtrl</string>
 							<string>_saveProgressBar</string>
 							<string>_saveProgressPanel</string>
+							<string>_tronPDFView</string>
 							<string>_zoomSegCtrl</string>
 						</object>
 						<object class="NSMutableArray" key="dict.values">
 							<string>NSTextFieldCell</string>
 							<string>NSTextFieldCell</string>
 							<string>NSTextFieldCell</string>
-							<string>PDFView</string>
+							<string>NSScrollView</string>
 							<string>NSSegmentedControl</string>
 							<string>NSProgressIndicator</string>
 							<string>NSPanel</string>
+							<string>TronPDFView</string>
 							<string>NSSegmentedControl</string>
 						</object>
 					</object>
 						<string key="minorKey">MyPDFWinController.h</string>
 					</object>
 				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">TronPDFView</string>
+					<string key="superclassName">NSView</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBProjectSource</string>
+						<string key="minorKey">TronPDFView.h</string>
+					</object>
+				</object>
 			</object>
 			<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
 				<bool key="EncodedWithXMLCoder">YES</bool>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier" id="320510443">
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
 						<string key="minorKey">PDFKit.framework/Headers/PDFView.h</string>
 					</object>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
+					<string key="className">NSScrollView</string>
+					<string key="superclassName">NSView</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">AppKit.framework/Headers/NSScrollView.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSScroller</string>
+					<string key="superclassName">NSControl</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">AppKit.framework/Headers/NSScroller.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
 					<string key="className">NSSegmentedCell</string>
 					<string key="superclassName">NSActionCell</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string>
 					</object>
 				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">PDFView</string>
-					<string key="superclassName">NSView</string>
-					<object class="NSMutableDictionary" key="actions">
-						<bool key="EncodedWithXMLCoder">YES</bool>
-						<object class="NSArray" key="dict.sortedKeys">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>goBack:</string>
-							<string>goForward:</string>
-							<string>goToFirstPage:</string>
-							<string>goToLastPage:</string>
-							<string>goToNextPage:</string>
-							<string>goToPreviousPage:</string>
-							<string>selectAll:</string>
-							<string>takeBackgroundColorFrom:</string>
-							<string>zoomIn:</string>
-							<string>zoomOut:</string>
-						</object>
-						<object class="NSMutableArray" key="dict.values">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>id</string>
-							<string>id</string>
-							<string>id</string>
-							<string>id</string>
-							<string>id</string>
-							<string>id</string>
-							<string>id</string>
-							<string>id</string>
-							<string>id</string>
-							<string>id</string>
-						</object>
-					</object>
-					<reference key="sourceIdentifier" ref="320510443"/>
-				</object>
 			</object>
 		</object>
 		<int key="IBDocument.localizationMode">0</int>
 #import <Quartz/Quartz.h>
 
 //pdftron
-#import <PDFDoc.h>
+#include <PDFDoc.h>
 
 @interface MyPDFDoc : NSDocument
 {
 @private
-    PDFDocument * _pdfDoc;
-    pdftron::PDF::PDFDoc * _myPDFDoc;
+    //PDFDocument * _pdfDoc;
+    pdftron::PDF::PDFDoc * _tronPDFDoc;
 }
 
-@property (readonly) PDFDocument * pdfDoc;
+//@property (readonly) PDFDocument * pdfDoc;
+
+@property (nonatomic, readonly) pdftron::PDF::PDFDoc * tronPDFDoc;
 
 
 
 #import "MyPDFDoc.h"
 #import "MyPDFWinController.h"
 
+#include <Common/Exception.h>
+#include <SDF/SDFDoc.h>
+
 @implementation MyPDFDoc
 
+/*
 @synthesize pdfDoc = _pdfDoc;
     
 -(void)setPdfDoc:(PDFDocument *)doc {
 -(PDFDocument*)getPdfDoc {
     return _pdfDoc;
 }
+ */
+
+@synthesize tronPDFDoc = _tronPDFDoc;
+
+-(pdftron::PDF::PDFDoc*)getTronPDFDoc {
+    return _tronPDFDoc;
+}
+
 
 
 - (id)init
 	[super windowControllerDidLoadNib: aController];
 }
 
-- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
-{
-    // Insert code here to write your document to data of the specified type. If the given outError != NULL, ensure that you set *outError when returning nil.
-
-    // You can also choose to override -fileWrapperOfType:error:, -writeToURL:ofType:error:, or -writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead.
-
-    // For applications targeted for Panther or earlier systems, you should use the deprecated API -dataRepresentationOfType:. In this case you can also choose to override -fileWrapperRepresentationOfType: or -writeToFile:ofType: instead.
-/*
-    if ( outError != NULL ) {
-		*outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL];
-	}
-	return nil;
- */
-    NSData * data = nil;
-    data = [self.pdfDoc dataRepresentation];
-    return data;
-}
-
-- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError
-{
-    // Insert code here to read your document from the given data of the specified type.  If the given outError != NULL, ensure that you set *outError when returning NO.
-
-    // You can also choose to override -readFromFileWrapper:ofType:error: or -readFromURL:ofType:error: instead.
-
-    // For applications targeted for Panther or earlier systems, you should use the deprecated API -loadDataRepresentation:ofType. In this case you can also choose to override -readFromFile:ofType: or -loadFileWrapperRepresentation:ofType: instead.
-
-    BOOL readSuccess = NO;
-    PDFDocument * doc = nil;
-    doc = [[PDFDocument alloc] initWithData:data];
-
-    if (doc != nil) {
-        [self setPdfDoc:doc];
-        readSuccess = YES;
-
-        [doc release];
-    }    
-    return readSuccess;
-}
-
 - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError {
     BOOL readSuccess = NO;
-
+/*
     PDFDocument * doc = [[PDFDocument alloc] initWithURL:absoluteURL];
     
     if (doc) {
         readSuccess = YES;
         [doc release];
     }
+
+ */
+    
+    NSLog(@"open file with path: %@", [absoluteURL path]);
+    try {
+        _tronPDFDoc = new pdftron::PDF::PDFDoc([[absoluteURL path] UTF8String]);
+        _tronPDFDoc->InitSecurityHandler();
+        readSuccess = YES;
+    }
+    catch (pdftron::Common::Exception e) {
+        NSLog(@"%@", [NSString stringWithUTF8String:e.ToString().c_str()]);
+    }
+           
     return readSuccess;
 }
 
 - (BOOL)writeToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError {
     BOOL writeSuccess = NO;
+    /*
     [_pdfDoc writeToURL:absoluteURL];
     writeSuccess = YES;
+     */
+    try {
+        _tronPDFDoc->Save([[absoluteURL path] UTF8String], pdftron::SDF::SDFDoc::e_linearized, NULL);
+        writeSuccess = YES;
+    }
+    catch (pdftron::Common::Exception e) {
+        NSLog(@"%@", [NSString stringWithUTF8String:e.ToString().c_str()]);
+    }
     return writeSuccess;
 }
 
 - (void)dealloc {
-    [self setPdfDoc:nil];
+    //[self setPdfDoc:nil];
     [super dealloc];
 }
 

MyPDFWinController.h

 //
 
 #import <Cocoa/Cocoa.h>
-#import <Quartz/Quartz.h>
+//#import <Quartz/Quartz.h>
 #import "MyPDFDoc.h"
 
-//pdftron
-#import <PDFViewCtrl.h>
+#import "TronPDFView.h"
 
 @interface MyPDFWinController : NSWindowController {
-    IBOutlet PDFView * _pdfView;
-    pdftron::PDF::PDFViewCtrl * _pdfViewCtrl;
+    IBOutlet NSScrollView * _pdfScrollView;
+    IBOutlet TronPDFView * _tronPDFView;
     
     // go to page panel
     IBOutlet NSPanel * _goToPagePanel;
     MyPDFDoc * _myPdfDoc;
 }
 
-@property (readonly) PDFView * pdfView;
 @property (readonly) MyPDFDoc * myPdfDoc;
 
 - (void)setupDocumentNotifications;

MyPDFWinController.mm

 
 @implementation MyPDFWinController
 
-@synthesize pdfView = _pdfView;
 @synthesize myPdfDoc = _myPdfDoc;
 
 #pragma mark    NSWindowController functions
 {
     [super windowDidLoad];
     
-    [_pdfView setDocument:_myPdfDoc.pdfDoc];
+    [_tronPDFView setDocument:_myPdfDoc];
+    
+    //[_pdfView setDocument:_myPdfDoc.pdfDoc];
+    /*
+    pdftron::PDF::PDFView * pdfView = [_tronPDFView getPDFView];
+
+    if (pdfView) {
+        //NSSize contentSize = [_tronPDFView contentSize];
+        pdfView->SetDoc(*(_myPdfDoc.tronPDFDoc));
+        pdfView->OnSize(300, 300);
+    }
+     */
+    //    [_tronPDFView setDocument:_myPdfDoc];
     
     //initialize toolbar
+    /*
     [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handlePageChange:) 
                                                  name: PDFViewPageChangedNotification object: _pdfView];
     [self handlePageChange:nil];
-    
+    */
     
     /*
 	PDFDocument	*pdfDoc;
 
 - (void) setupDocumentNotifications 
 {
+    /*
     // Document saving progress notifications.
 	[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(documentBeginWrite:) 
                                                  name: @"PDFDidBeginDocumentWrite" object: [_pdfView document]];
 	[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(documentEndWrite:) 
                                                  name: @"PDFDidEndDocumentWrite" object: [_pdfView document]];
 	[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(documentEndPageWrite:) 
-                                                 name: @"PDFDidEndPageWrite" object: [_pdfView document]];
-    
+    */
 }
 
 #pragma mark    actions
 - (IBAction)doGoToNextPage:(id)sender
 {
     NSLog(@"in doGoToNextPage");
-    [_pdfView goToNextPage:sender];
+    //[_pdfView goToNextPage:sender];
 }
 
 - (IBAction)doGoToPreviousPage:(id)sender
 {
     NSLog(@"in doGoToPreviousPage");    
-    [_pdfView goToPreviousPage:sender];
+    //[_pdfView goToPreviousPage:sender];
 }
 
 - (IBAction)doGoToPagePanel:(id)sender
 {
     NSLog(@"in doGoToPagePanel...");    
+    /*
     // Specify page range.
 	[_goTopagePanelRangeLabel setStringValue: [NSString stringWithFormat:  
                                             NSLocalizedString(@"Go to page (%@ to %@):", NULL), [[[_pdfView document] pageAtIndex: 0] label], 
 	// Bring up the page number panel as a sheet.
 	[NSApp beginSheet: _goToPagePanel modalForWindow: [self window] modalDelegate: self 
        didEndSelector: @selector(goToPagePanelDidEnd: returnCode: contextInfo:) contextInfo: NULL];
+     */
 }
 
 - (IBAction)doGoToPageNumberEntered:(id)sender
 {
+    /*
     int index = [self getIndexFromLabel:[_goToPagePanelPageLabel stringValue] pdfDoc:[_pdfView document]];
     [NSApp endSheet: _goToPagePanel returnCode: index];
+     */
 }
 
 - (IBAction)doGoToPagePanelCancel:(id)sender
 
 - (void) goToPagePanelDidEnd: (NSWindow *) sheet returnCode: (int) returnCode contextInfo: (void *) contextInfo
 {
+    /*
 	[_goToPagePanel close];
 	
 	// Make sure page number entered is valid.
 	
 	// Go to that page.
 	[_pdfView goToPage: [[_pdfView document] pageAtIndex: returnCode - 1]];
+     */
 }
 
 - (IBAction)removeCurrentPage:(id)sender
 {
+    /*
     PDFDocument * pdfDoc = _myPdfDoc.pdfDoc;
     PDFPage * current_page = [_pdfView currentPage];
     [pdfDoc removePageAtIndex:[pdfDoc indexForPage:current_page]];
     [_pdfView setNeedsDisplay:YES];
     [_myPdfDoc updateChangeCount:NSChangeDone];
+     */
 }
 
 - (IBAction)goToSpecifiedPage:(id)sender
 {
+    /*
     NSLog(@"goToSpecifiedPage");
     NSString * pages = [_pagesTextField stringValue];
     int page_num = [self getIndexFromLabel:pages pdfDoc:[_myPdfDoc pdfDoc]];
     [_pdfView goToPage:[[_pdfView document] pageAtIndex:page_num - 1]];
+     */
 }
 
 - (void)handlePageChange:(NSNotification*) notification
 {
     NSLog(@"updatePageNumField");
+    /*
     [_pagesTextField setStringValue:[[_pdfView currentPage] label]];
     
     [_previousNextPageSegCtrl setEnabled:[_pdfView canGoToPreviousPage] forSegment:0];
     [_previousNextPageSegCtrl setEnabled:[_pdfView canGoToNextPage] forSegment:1];
+     */
 }
 
 - (IBAction)goPreviousNextPage:(id)sender
     NSLog(@"goPreviousNextPage");
     NSInteger seg_index = [_previousNextPageSegCtrl selectedSegment];
     if (seg_index == 0) {
-        [_pdfView goToPreviousPage:sender];
+        //[_pdfView goToPreviousPage:sender];
     }
     else if (seg_index == 1) {
-        [_pdfView goToNextPage:sender];
+        //[_pdfView goToNextPage:sender];
     }
 }
 
     NSLog(@"doZoom");
     NSInteger seg_index = [_zoomSegCtrl selectedSegment];
     if (seg_index == 0) {
-        [_pdfView zoomOut:sender];
+        //[_pdfView zoomOut:sender];
     } 
     else if (seg_index == 1) {
-        [_pdfView zoomIn:sender];
+        //[_pdfView zoomIn:sender];
     }
 }
 
 - (void) documentBeginWrite: (NSNotification *) notification
 {
 	// Establish maximum and current value for progress bar.
-	[_saveProgressBar setMaxValue: (double)[[_pdfView document] pageCount]];
+	//[_saveProgressBar setMaxValue: (double)[[_pdfView document] pageCount]];
 	[_saveProgressBar setDoubleValue: 0.0];
 	
 	// Bring up the save panel as a sheet.
+//
+//  TronPDFView.h
+//  cocoapdf
+//
+//  Created by Quincy on 10-07-25.
+//  Copyright 2010 __MyCompanyName__. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "MyPDFDoc.h"
+
+#include <PDF/PDFView.h>
+
+@interface TronPDFView : NSView {
+    pdftron::PDF::PDFView * _tronPDFView;
+}
+
+@property (nonatomic) pdftron::PDF::PDFView * tronPDFView;
+
+- (pdftron::PDF::PDFView *) getPDFView;
+
+- (void)setDocument:(MyPDFDoc*) myDoc;
+
+
+
+@end
+
+void beginRendering(void* data);
+
+void endRendering(void* data, bool canceled);
+//
+//  TronPDFView.mm
+//  cocoapdf
+//
+//  Created by Quincy on 10-07-25.
+//  Copyright 2010 __MyCompanyName__. All rights reserved.
+//
+
+#import "TronPDFView.h"
+
+void beginRendering(void* data) {
+    // NSLog(@"%@", "begin rendering");
+    //printf("begin rendering");
+}
+
+void endRendering(void* data, bool canceled) {
+    //printf("end rendering");
+}
+
+@implementation TronPDFView
+
+@synthesize tronPDFView = _tronPDFView;
+
+- (pdftron::PDF::PDFView *) getPDFView {
+    return _tronPDFView;
+}
+
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    _tronPDFView = new pdftron::PDF::PDFView();
+}
+
+- (void)drawRect:(NSRect)dirtyRect {
+    NSRect rect = [self bounds];
+    NSPoint p = rect.origin;
+    NSSize s = rect.size;
+    NSLog(@"self bound: x: %0.4f, y: %0.4f, w: %0.4f, h: %0.4f", p.x, p.y, s.width, s.height);
+    if (_tronPDFView->GetDoc()) {
+        _tronPDFView->OnSize((int) s.width, (int) s.height);
+        
+        const char* bgra = _tronPDFView->GetBuffer();
+        if (bgra) {
+            int width = _tronPDFView->GetBufferWidth();
+            int height = _tronPDFView->GetBufferHeight();
+            char * rgba = (char *) malloc(width * height * 4);
+            for (int i = 0; i < width * height; ++i) {
+                rgba[4*i] = bgra[4*i + 2];
+                rgba[4*i + 1] = bgra[4*i + 1];
+                rgba[4*i + 2] = bgra[4*i];
+                rgba[4*i + 3] = bgra[4*i + 3];
+            }
+            CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+            CGContextRef bitmapContext = CGBitmapContextCreate(rgba,
+                                                               width,
+                                                               height,
+                                                               8, // bitsPerComponent
+                                                               4*width, // bytesPerRow
+                                                               colorSpace,
+                                                               kCGImageAlphaPremultipliedLast);
+            
+            
+            CFRelease(colorSpace);
+            
+            CGImageRef cgImage = CGBitmapContextCreateImage(bitmapContext);
+            
+            __strong NSGraphicsContext	*	nsGraphicsContext	= [NSGraphicsContext currentContext];
+            __strong CGContextRef			zCgContextRef		= (CGContextRef) [nsGraphicsContext graphicsPort];
+            
+            
+            NSRect imageRect;
+            imageRect.origin = NSZeroPoint;
+            imageRect.size.width = s.width;
+            imageRect.size.height = s.height;
+            CGRect	zCgRect	= NSRectToCGRect(imageRect);
+
+            CGContextDrawImage(zCgContextRef, zCgRect, cgImage);
+            
+            CFRelease(cgImage);
+            CFRelease(bitmapContext);
+            free(rgba);
+        }
+    }
+
+}
+/*
+-(BOOL)isFlipped {
+    return YES;
+}
+*/
+
+- (void)dealloc {
+    [super dealloc];
+    if (_tronPDFView) {
+        free(_tronPDFView);
+    }
+}
+
+
+
+- (void)setDocument:(MyPDFDoc*) myDoc {
+    if (_tronPDFView) {
+        _tronPDFView->SetDoc(*(myDoc.tronPDFDoc));
+        _tronPDFView->SetRenderBeginProc(beginRendering, NULL);
+        _tronPDFView->SetRenderFinishProc(endRendering, NULL);
+    }
+}
+
+@end

cocoapdf.xcodeproj/project.pbxproj

 /* Begin PBXBuildFile section */
 		1DDD582C0DA1D0D100B32029 /* MyPDFDocWin.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58280DA1D0D100B32029 /* MyPDFDocWin.xib */; };
 		1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */; };
+		241D2A8F11FBD1F40067260B /* libPDFNetC.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 241D2A8E11FBD1F40067260B /* libPDFNetC.dylib */; };
+		2475874111FD068E00F243C8 /* TronPDFView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2475874011FD068E00F243C8 /* TronPDFView.mm */; };
 		247B632611F6C30C000D0151 /* ASCII85Encode.inl in Resources */ = {isa = PBXBuildFile; fileRef = 247B5C2811F6C307000D0151 /* ASCII85Encode.inl */; };
 		247B632711F6C30C000D0151 /* AttrObj.inl in Resources */ = {isa = PBXBuildFile; fileRef = 247B5C2911F6C307000D0151 /* AttrObj.inl */; };
 		247B632811F6C30C000D0151 /* ClassMap.inl in Resources */ = {isa = PBXBuildFile; fileRef = 247B5C2A11F6C307000D0151 /* ClassMap.inl */; };
 		247B635F11F6C30C000D0151 /* index.html in Resources */ = {isa = PBXBuildFile; fileRef = 247B5CBC11F6C308000D0151 /* index.html */; };
 		247B636011F6C30C000D0151 /* legal.txt in Resources */ = {isa = PBXBuildFile; fileRef = 247B5CBD11F6C308000D0151 /* legal.txt */; };
 		247B636111F6C30C000D0151 /* libinfo.txt in Resources */ = {isa = PBXBuildFile; fileRef = 247B5CBF11F6C308000D0151 /* libinfo.txt */; };
-		247B636211F6C30C000D0151 /* libPDFNetC.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 247B5CC011F6C309000D0151 /* libPDFNetC.dylib */; };
 		247B636411F6C30C000D0151 /* license.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 247B5CC211F6C309000D0151 /* license.pdf */; };
 		247B636511F6C30C000D0151 /* readme.txt in Resources */ = {isa = PBXBuildFile; fileRef = 247B5CC311F6C309000D0151 /* readme.txt */; };
 		247B636611F6C30C000D0151 /* setup.sh in Resources */ = {isa = PBXBuildFile; fileRef = 247B5CC411F6C309000D0151 /* setup.sh */; };
 		13E42FBA07B3F13500E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
 		1DDD58290DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MyPDFDocWin.xib; sourceTree = "<group>"; };
 		1DDD582B0DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
+		241D2A8E11FBD1F40067260B /* libPDFNetC.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libPDFNetC.dylib; sourceTree = "<group>"; };
+		2475873F11FD068E00F243C8 /* TronPDFView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TronPDFView.h; sourceTree = "<group>"; };
+		2475874011FD068E00F243C8 /* TronPDFView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TronPDFView.mm; sourceTree = "<group>"; };
 		247B5BCE11F6C306000D0151 /* TRN_Config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TRN_Config.h; sourceTree = "<group>"; };
 		247B5BCF11F6C306000D0151 /* TRN_Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TRN_Exception.h; sourceTree = "<group>"; };
 		247B5BD011F6C306000D0151 /* TRN_Iterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TRN_Iterator.h; sourceTree = "<group>"; };
 		247B5CBC11F6C308000D0151 /* index.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = index.html; sourceTree = "<group>"; };
 		247B5CBD11F6C308000D0151 /* legal.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = legal.txt; sourceTree = "<group>"; };
 		247B5CBF11F6C308000D0151 /* libinfo.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = libinfo.txt; sourceTree = "<group>"; };
-		247B5CC011F6C309000D0151 /* libPDFNetC.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libPDFNetC.dylib; sourceTree = "<group>"; };
 		247B5CC211F6C309000D0151 /* license.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = license.pdf; sourceTree = "<group>"; };
 		247B5CC311F6C309000D0151 /* readme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = readme.txt; sourceTree = "<group>"; };
 		247B5CC411F6C309000D0151 /* setup.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = setup.sh; sourceTree = "<group>"; };
 			files = (
 				8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */,
 				249250AB11CB3EA30076F523 /* Quartz.framework in Frameworks */,
-				247B636211F6C30C000D0151 /* libPDFNetC.dylib in Frameworks */,
+				241D2A8F11FBD1F40067260B /* libPDFNetC.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 		247B5CBE11F6C308000D0151 /* Lib */ = {
 			isa = PBXGroup;
 			children = (
+				241D2A8E11FBD1F40067260B /* libPDFNetC.dylib */,
 				247B5CBF11F6C308000D0151 /* libinfo.txt */,
-				247B5CC011F6C309000D0151 /* libPDFNetC.dylib */,
 			);
 			path = Lib;
 			sourceTree = "<group>";
 				2A37F4ACFDCFA73011CA2CEA /* MyPDFDoc.mm */,
 				5B02B6E311E5215A0022BB1A /* MyPDFWinController.h */,
 				5B02B6E411E5215A0022BB1A /* MyPDFWinController.mm */,
+				2475873F11FD068E00F243C8 /* TronPDFView.h */,
+				2475874011FD068E00F243C8 /* TronPDFView.mm */,
 			);
 			name = Classes;
 			sourceTree = "<group>";
 				8D15AC320486D014006FF6A4 /* main.mm in Sources */,
 				5B02B6C011E517E80022BB1A /* MainMenuController.mm in Sources */,
 				5B02B6E511E5215A0022BB1A /* MyPDFWinController.mm in Sources */,
+				2475874111FD068E00F243C8 /* TronPDFView.mm in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 					"$(inherited)",
 					"\"$(SRCROOT)/PDFNetC/Lib\"",
 				);
+				MACH_O_TYPE = mh_execute;
 				ONLY_ACTIVE_ARCH = YES;
+				OTHER_LDFLAGS = (
+					"-I",
+					"$(SRCROOT)/PDFNetC/Headers",
+				);
 				PRODUCT_NAME = cocoapdf;
+				STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;
 			};
 			name = Debug;
 		};
 					"$(inherited)",
 					"\"$(SRCROOT)/PDFNetC/Lib\"",
 				);
+				MACH_O_TYPE = mh_execute;
 				ONLY_ACTIVE_ARCH = YES;
+				OTHER_LDFLAGS = (
+					"-I",
+					"$(SRCROOT)/PDFNetC/Headers",
+				);
 				PRODUCT_NAME = cocoapdf;
+				STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;
 			};
 			name = Release;
 		};

cocoapdf.xcodeproj/quincy.mode1v3

 			<key>Content</key>
 			<dict>
 				<key>PBXProjectModuleGUID</key>
-				<string>247B469911F6B6BB000D0151</string>
+				<string>246738901206E21200157160</string>
 				<key>PBXProjectModuleLabel</key>
-				<string>TRN_PDFDocViewPrefs.h</string>
+				<string>TronPDFView.mm</string>
 				<key>PBXSplitModuleInNavigatorKey</key>
 				<dict>
 					<key>Split0</key>
 					<dict>
 						<key>PBXProjectModuleGUID</key>
-						<string>247B54B011F6B7BB000D0151</string>
+						<string>246738991206E28200157160</string>
 						<key>PBXProjectModuleLabel</key>
-						<string>TRN_PDFDocViewPrefs.h</string>
+						<string>TronPDFView.mm</string>
 						<key>_historyCapacity</key>
 						<integer>0</integer>
 						<key>bookmark</key>
-						<string>247B555611F6C1DD000D0151</string>
+						<string>246738FB1206E8D400157160</string>
 						<key>history</key>
 						<array>
-							<string>247B54C411F6B92E000D0151</string>
-							<string>247B54C511F6B92E000D0151</string>
-							<string>247B54D911F6BD27000D0151</string>
-							<string>247B54F211F6BE20000D0151</string>
-							<string>247B54F311F6BE20000D0151</string>
-							<string>247B54F411F6BE20000D0151</string>
-							<string>247B54F511F6BE20000D0151</string>
-							<string>247B550811F6BECC000D0151</string>
-							<string>247B550911F6BECC000D0151</string>
-							<string>247B550A11F6BECC000D0151</string>
-							<string>247B550B11F6BECC000D0151</string>
-							<string>247B554711F6C1DD000D0151</string>
-							<string>247B554811F6C1DD000D0151</string>
-							<string>247B554911F6C1DD000D0151</string>
-							<string>247B554A11F6C1DD000D0151</string>
-							<string>247B554B11F6C1DD000D0151</string>
-							<string>247B554C11F6C1DD000D0151</string>
-							<string>247B554D11F6C1DD000D0151</string>
-							<string>247B554E11F6C1DD000D0151</string>
-							<string>247B554F11F6C1DD000D0151</string>
-							<string>247B555011F6C1DD000D0151</string>
-							<string>247B555111F6C1DD000D0151</string>
-							<string>247B555211F6C1DD000D0151</string>
-							<string>247B555311F6C1DD000D0151</string>
-							<string>247B555411F6C1DD000D0151</string>
-							<string>247B555511F6C1DD000D0151</string>
-							<string>247B554511F6C1D9000D0151</string>
+							<string>246738C21206E47100157160</string>
+							<string>246738C31206E47100157160</string>
+							<string>246738D51206E61100157160</string>
+							<string>246738D71206E61100157160</string>
+							<string>246738EA1206E76C00157160</string>
+							<string>246738E81206E76900157160</string>
 						</array>
 					</dict>
 					<key>SplitCount</key>
 			<key>Geometry</key>
 			<dict>
 				<key>Frame</key>
-				<string>{{0, 20}, {808, 502}}</string>
+				<string>{{0, 20}, {1003, 601}}</string>
 				<key>PBXModuleWindowStatusBarHidden2</key>
 				<false/>
 				<key>RubberWindowFrame</key>
-				<string>133 167 808 543 0 0 1280 778 </string>
+				<string>87 110 1003 642 0 0 1280 778 </string>
 			</dict>
 		</dict>
 	</array>
 			<key>Layout</key>
 			<array>
 				<dict>
-					<key>BecomeActive</key>
-					<true/>
 					<key>ContentConfiguration</key>
 					<dict>
 						<key>PBXBottomSmartGroupGIDs</key>
 							<array>
 								<string>2A37F4AAFDCFA73011CA2CEA</string>
 								<string>2A37F4ABFDCFA73011CA2CEA</string>
+								<string>2A37F4AFFDCFA73011CA2CEA</string>
+								<string>2A37F4B8FDCFA73011CA2CEA</string>
 								<string>2A37F4C3FDCFA73011CA2CEA</string>
 								<string>19C28FB0FE9D524F11CA2CBB</string>
 								<string>1C37FBAC04509CD000000102</string>
 							<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
 							<array>
 								<array>
-									<integer>18</integer>
-									<integer>17</integer>
+									<integer>2</integer>
+									<integer>0</integer>
 								</array>
 							</array>
 							<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
-							<string>{{0, 0}, {352, 445}}</string>
+							<string>{{0, 10}, {352, 445}}</string>
 						</dict>
 						<key>PBXTopSmartGroupGIDs</key>
 						<array/>
 							<real>352</real>
 						</array>
 						<key>RubberWindowFrame</key>
-						<string>321 164 788 504 0 0 1280 778 </string>
+						<string>190 177 788 504 0 0 1280 778 </string>
 					</dict>
 					<key>Module</key>
 					<string>PBXSmartGroupTreeModule</string>
 								<key>PBXProjectModuleGUID</key>
 								<string>1CE0B20306471E060097A5F4</string>
 								<key>PBXProjectModuleLabel</key>
-								<string>MyPDFWinController.mm</string>
+								<string>TronPDFView.mm</string>
 								<key>PBXSplitModuleInNavigatorKey</key>
 								<dict>
 									<key>Split0</key>
 										<key>PBXProjectModuleGUID</key>
 										<string>1CE0B20406471E060097A5F4</string>
 										<key>PBXProjectModuleLabel</key>
-										<string>MyPDFWinController.mm</string>
+										<string>TronPDFView.mm</string>
 										<key>_historyCapacity</key>
 										<integer>0</integer>
 										<key>bookmark</key>
-										<string>247B554611F6C1DD000D0151</string>
+										<string>246738FA1206E8D400157160</string>
 										<key>history</key>
 										<array>
-											<string>24FE559711F2E2DB00CEEE7F</string>
-											<string>247B466411F6B137000D0151</string>
-											<string>247B467011F6B2C2000D0151</string>
-											<string>247B54D411F6BD27000D0151</string>
-											<string>247B54D511F6BD27000D0151</string>
-											<string>247B54D611F6BD27000D0151</string>
-											<string>247B466F11F6B2C2000D0151</string>
+											<string>241D2A8211FBCBED0067260B</string>
+											<string>241D2A8311FBCBED0067260B</string>
+											<string>241D2ABA11FBE6FD0067260B</string>
+											<string>247587CE11FD10DB00F243C8</string>
+											<string>2479D4AF11FD2A100022D97A</string>
+											<string>24926A6011FD7BB1000C72BD</string>
+											<string>24247DD311FED53600B478C1</string>
+											<string>24247E1211FED76E00B478C1</string>
+											<string>24204F5811FFEA7D005F35FB</string>
+											<string>24204F7411FFEAFA005F35FB</string>
+											<string>24204F7511FFEAFA005F35FB</string>
+											<string>24204FA111FFEF54005F35FB</string>
+											<string>248C458B1206888100210F73</string>
+											<string>248C45C01206919E00210F73</string>
+											<string>2467386E1206E11D00157160</string>
+											<string>246738851206E1F400157160</string>
+											<string>246738861206E1F400157160</string>
 										</array>
 									</dict>
 									<key>SplitCount</key>
 							<key>GeometryConfiguration</key>
 							<dict>
 								<key>Frame</key>
-								<string>{{0, 0}, {414, 135}}</string>
+								<string>{{0, 0}, {414, 213}}</string>
 								<key>RubberWindowFrame</key>
-								<string>321 164 788 504 0 0 1280 778 </string>
+								<string>190 177 788 504 0 0 1280 778 </string>
 							</dict>
 							<key>Module</key>
 							<string>PBXNavigatorGroup</string>
 							<key>Proportion</key>
-							<string>135pt</string>
+							<string>213pt</string>
 						</dict>
 						<dict>
+							<key>BecomeActive</key>
+							<true/>
 							<key>ContentConfiguration</key>
 							<dict>
 								<key>PBXProjectModuleGUID</key>
 							<key>GeometryConfiguration</key>
 							<dict>
 								<key>Frame</key>
-								<string>{{0, 140}, {414, 323}}</string>
+								<string>{{0, 218}, {414, 245}}</string>
 								<key>RubberWindowFrame</key>
-								<string>321 164 788 504 0 0 1280 778 </string>
+								<string>190 177 788 504 0 0 1280 778 </string>
 							</dict>
 							<key>Module</key>
 							<string>XCDetailModule</string>
 							<key>Proportion</key>
-							<string>323pt</string>
+							<string>245pt</string>
 						</dict>
 					</array>
 					<key>Proportion</key>
 			</array>
 			<key>TableOfContents</key>
 			<array>
-				<string>247B468511F6B443000D0151</string>
+				<string>246738461206DEBF00157160</string>
 				<string>1CE0B1FE06471DED0097A5F4</string>
-				<string>247B468611F6B443000D0151</string>
+				<string>246738471206DEBF00157160</string>
 				<string>1CE0B20306471E060097A5F4</string>
 				<string>1CE0B20506471E060097A5F4</string>
 			</array>
 	<key>PerspectivesBarVisible</key>
 	<false/>
 	<key>PinnedNavigatorIdentifier</key>
-	<string>247B469911F6B6BB000D0151</string>
+	<string>246738901206E21200157160</string>
 	<key>ShelfIsVisible</key>
 	<false/>
 	<key>SourceDescription</key>
 	<integer>5</integer>
 	<key>WindowOrderList</key>
 	<array>
+		<string>246738FC1206E8D400157160</string>
+		<string>246738521206DEBF00157160</string>
+		<string>246738531206DEBF00157160</string>
+		<string>1CD10A99069EF8BA00B06720</string>
 		<string>/Users/quincy/Repositories/CocoaPDF/cocoapdf.xcodeproj</string>
 		<string>2492503F11CB2A5D0076F523</string>
-		<string>247B469911F6B6BB000D0151</string>
+		<string>1C78EAAD065D492600B07095</string>
+		<string>246738901206E21200157160</string>
 	</array>
 	<key>WindowString</key>
-	<string>321 164 788 504 0 0 1280 778 </string>
+	<string>190 177 788 504 0 0 1280 778 </string>
 	<key>WindowToolsV3</key>
 	<array>
 		<dict>
 								<key>PBXProjectModuleGUID</key>
 								<string>1CD0528F0623707200166675</string>
 								<key>PBXProjectModuleLabel</key>
-								<string>PDFDoc.h</string>
+								<string>TronPDFView.mm</string>
 								<key>StatusBarVisibility</key>
 								<true/>
 							</dict>
 								<key>Frame</key>
 								<string>{{0, 0}, {500, 218}}</string>
 								<key>RubberWindowFrame</key>
-								<string>808 131 500 500 0 0 1280 778 </string>
+								<string>92 234 500 500 0 0 1280 778 </string>
 							</dict>
 							<key>Module</key>
 							<string>PBXNavigatorGroup</string>
 								<key>Frame</key>
 								<string>{{0, 223}, {500, 236}}</string>
 								<key>RubberWindowFrame</key>
-								<string>808 131 500 500 0 0 1280 778 </string>
+								<string>92 234 500 500 0 0 1280 778 </string>
 							</dict>
 							<key>Module</key>
 							<string>PBXBuildResultsModule</string>
 			<key>TableOfContents</key>
 			<array>
 				<string>2492503F11CB2A5D0076F523</string>
-				<string>247B468711F6B443000D0151</string>
+				<string>246738491206DEBF00157160</string>
 				<string>1CD0528F0623707200166675</string>
 				<string>XCMainBuildResultsModuleGUID</string>
 			</array>
 			<key>WindowContentMinSize</key>
 			<string>486 300</string>
 			<key>WindowString</key>
-			<string>808 131 500 500 0 0 1280 778 </string>
+			<string>92 234 500 500 0 0 1280 778 </string>
 			<key>WindowToolGUID</key>
 			<string>2492503F11CB2A5D0076F523</string>
 			<key>WindowToolIsVisible</key>
 										<string>yes</string>
 										<key>sizes</key>
 										<array>
-											<string>{{0, 0}, {585, 213}}</string>
-											<string>{{585, 0}, {323, 213}}</string>
+											<string>{{0, 0}, {461, 325}}</string>
+											<string>{{461, 0}, {637, 325}}</string>
 										</array>
 									</dict>
 									<key>VerticalSplitView</key>
 										<string>yes</string>
 										<key>sizes</key>
 										<array>
-											<string>{{0, 0}, {908, 213}}</string>
-											<string>{{0, 213}, {908, 186}}</string>
+											<string>{{0, 0}, {1098, 325}}</string>
+											<string>{{0, 325}, {1098, 289}}</string>
 										</array>
 									</dict>
 								</dict>
 								<key>DebugSTDIOWindowFrame</key>
 								<string>{{200, 200}, {500, 300}}</string>
 								<key>Frame</key>
-								<string>{{0, 0}, {908, 399}}</string>
+								<string>{{0, 0}, {1098, 614}}</string>
 								<key>PBXDebugSessionStackFrameViewKey</key>
 								<dict>
 									<key>DebugVariablesTableConfiguration</key>
 										<string>Value</string>
 										<real>85</real>
 										<string>Summary</string>
-										<real>80</real>
+										<real>394</real>
 									</array>
 									<key>Frame</key>
-									<string>{{585, 0}, {323, 213}}</string>
+									<string>{{461, 0}, {637, 325}}</string>
 									<key>RubberWindowFrame</key>
-									<string>180 211 908 440 0 0 1280 778 </string>
+									<string>143 110 1098 655 0 0 1280 778 </string>
 								</dict>
 								<key>RubberWindowFrame</key>
-								<string>180 211 908 440 0 0 1280 778 </string>
+								<string>143 110 1098 655 0 0 1280 778 </string>
 							</dict>
 							<key>Module</key>
 							<string>PBXDebugSessionModule</string>
 							<key>Proportion</key>
-							<string>399pt</string>
+							<string>614pt</string>
 						</dict>
 					</array>
 					<key>Proportion</key>
-					<string>399pt</string>
+					<string>614pt</string>
 				</dict>
 			</array>
 			<key>Name</key>
 			<key>TableOfContents</key>
 			<array>
 				<string>1CD10A99069EF8BA00B06720</string>
-				<string>24B721DF11F3072400B96E24</string>
+				<string>2467384A1206DEBF00157160</string>
 				<string>1C162984064C10D400B95A72</string>
-				<string>24B721E011F3072400B96E24</string>
-				<string>24B721E111F3072400B96E24</string>
-				<string>24B721E211F3072400B96E24</string>
-				<string>24B721E311F3072400B96E24</string>
-				<string>24B721E411F3072400B96E24</string>
+				<string>2467384B1206DEBF00157160</string>
+				<string>2467384C1206DEBF00157160</string>
+				<string>2467384D1206DEBF00157160</string>
+				<string>2467384E1206DEBF00157160</string>
+				<string>2467384F1206DEBF00157160</string>
 			</array>
 			<key>ToolbarConfiguration</key>
 			<string>xcode.toolbar.config.debugV3</string>
 			<key>WindowString</key>
-			<string>180 211 908 440 0 0 1280 778 </string>
+			<string>143 110 1098 655 0 0 1280 778 </string>
 			<key>WindowToolGUID</key>
 			<string>1CD10A99069EF8BA00B06720</string>
 			<key>WindowToolIsVisible</key>
 					<key>Dock</key>
 					<array>
 						<dict>
+							<key>BecomeActive</key>
+							<true/>
 							<key>ContentConfiguration</key>
 							<dict>
 								<key>PBXProjectModuleGUID</key>
 							<key>GeometryConfiguration</key>
 							<dict>
 								<key>Frame</key>
-								<string>{{0, 0}, {650, 209}}</string>
+								<string>{{0, 0}, {568, 364}}</string>
 								<key>RubberWindowFrame</key>
-								<string>672 459 650 250 0 0 1280 778 </string>
+								<string>630 304 568 405 0 0 1280 778 </string>
 							</dict>
 							<key>Module</key>
 							<string>PBXDebugCLIModule</string>
 							<key>Proportion</key>
-							<string>209pt</string>
+							<string>364pt</string>
 						</dict>
 					</array>
 					<key>Proportion</key>
-					<string>209pt</string>
+					<string>364pt</string>
 				</dict>
 			</array>
 			<key>Name</key>
 			<key>TableOfContents</key>
 			<array>
 				<string>1C78EAAD065D492600B07095</string>
-				<string>24B721E511F3072400B96E24</string>
+				<string>246738501206DEBF00157160</string>
 				<string>1C78EAAC065D492600B07095</string>
 			</array>
 			<key>ToolbarConfiguration</key>
 			<string>xcode.toolbar.config.consoleV3</string>
 			<key>WindowString</key>
-			<string>672 459 650 250 0 0 1280 778 </string>
+			<string>630 304 568 405 0 0 1280 778 </string>
 			<key>WindowToolGUID</key>
 			<string>1C78EAAD065D492600B07095</string>
 			<key>WindowToolIsVisible</key>
-			<false/>
+			<true/>
 		</dict>
 		<dict>
 			<key>Identifier</key>
 			<string>743 379 452 308 0 0 1280 1002 </string>
 		</dict>
 		<dict>
+			<key>FirstTimeWindowDisplayed</key>
+			<false/>
 			<key>Identifier</key>
 			<string>windowTool.breakpoints</string>
 			<key>IsVertical</key>
-			<integer>0</integer>
+			<false/>
 			<key>Layout</key>
 			<array>
 				<dict>
 					<key>Dock</key>
 					<array>
 						<dict>
-							<key>BecomeActive</key>
-							<integer>1</integer>
 							<key>ContentConfiguration</key>
 							<dict>
 								<key>PBXBottomSmartGroupGIDs</key>
 								<key>PBXTopSmartGroupGIDs</key>
 								<array/>
 								<key>XCIncludePerspectivesSwitch</key>
-								<integer>0</integer>
+								<false/>
 							</dict>
 							<key>GeometryConfiguration</key>
 							<dict>
 									<real>168</real>
 								</array>
 								<key>RubberWindowFrame</key>
-								<string>315 424 744 409 0 0 1440 878 </string>
+								<string>201 219 744 409 0 0 1280 778 </string>
 							</dict>
 							<key>Module</key>
 							<string>PBXSmartGroupTreeModule</string>
 							<string>185pt</string>
 						</dict>
 						<dict>
+							<key>BecomeActive</key>
+							<true/>
 							<key>ContentConfiguration</key>
 							<dict>
 								<key>PBXProjectModuleGUID</key>
 								<key>Frame</key>
 								<string>{{190, 0}, {554, 368}}</string>
 								<key>RubberWindowFrame</key>
-								<string>315 424 744 409 0 0 1440 878 </string>
+								<string>201 219 744 409 0 0 1280 778 </string>
 							</dict>
 							<key>Module</key>
 							<string>XCDetailModule</string>
 				<string>XCDetailModule</string>
 			</array>
 			<key>StatusbarIsVisible</key>
-			<integer>1</integer>
+			<true/>
 			<key>TableOfContents</key>
 			<array>
-				<string>1CDDB66807F98D9800BB5817</string>
-				<string>1CDDB66907F98D9800BB5817</string>
+				<string>24247D1011FE876E00B478C1</string>
+				<string>24247D1111FE876E00B478C1</string>
 				<string>1CE0B1FE06471DED0097A5F4</string>
 				<string>1CA1AED706398EBD00589147</string>
 			</array>
 			<key>ToolbarConfiguration</key>
 			<string>xcode.toolbar.config.breakpointsV3</string>
 			<key>WindowString</key>
-			<string>315 424 744 409 0 0 1440 878 </string>
+			<string>201 219 744 409 0 0 1280 778 </string>
 			<key>WindowToolGUID</key>
-			<string>1CDDB66807F98D9800BB5817</string>
+			<string>24247D1011FE876E00B478C1</string>
 			<key>WindowToolIsVisible</key>
-			<integer>1</integer>
+			<false/>
 		</dict>
 		<dict>
 			<key>Identifier</key>
 //
 
 #import <Cocoa/Cocoa.h>
+#include <PDFNet.h>
 
 int main(int argc, char *argv[])
 {
+    try {
+        pdftron::PDFNet::Initialize();
+    }
+    catch (pdftron::Common::Exception& e) {
+        printf("%s", e.ToString().c_str());
+    }
+
     return NSApplicationMain(argc, (const char **) argv);
 }