Revision: 2764 http://skim-app.svn.sourceforge.net/skim-app/?rev=2764&view=rev Author: hofman Date: 2007-08-28 16:57:57 -0700 (Tue, 28 Aug 2007)
Log Message: ----------- Save the text of the PDF in the PDF bundle. Will be used to index for Spotlight. Modified Paths: -------------- trunk/SKDocument.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-28 23:02:12 UTC (rev 2763) +++ trunk/SKDocument.m 2007-08-28 23:57:57 UTC (rev 2764) @@ -65,9 +65,10 @@ #define MAX_XATTR_LENGTH 2048 #define WRAPPER_PDF_FILENAME @"data.pdf" -#define WRAPPER_SKIM_FILENAME @"data.skim" -#define WRAPPER_TXT_FILENAME @"data.txt" -#define WRAPPER_RTF_FILENAME @"data.rtf" +#define WRAPPER_TEXT_FILENAME @"data.txt" +#define WRAPPER_SKIM_FILENAME @"notes.skim" +#define WRAPPER_TXT_FILENAME @"notes.txt" +#define WRAPPER_RTF_FILENAME @"notes.rtf" NSString *SKDocumentErrorDomain = @"SKDocumentErrorDomain"; @@ -327,11 +328,14 @@ didWrite = [pdfData writeToURL:absoluteURL options:NSAtomicWrite error:outError] && [self saveNotesToExtendedAttributesAtURL:absoluteURL error:outError]; } else if ([typeName isEqualToString:SKPDFBundleDocumentType]) { + NSData *textData = [[[self pdfDocument] string] dataUsingEncoding:NSUTF8StringEncoding]; NSData *notesData = [[self notes] count] ? [NSKeyedArchiver archivedDataWithRootObject:[[self notes] valueForKey:@"dictionaryValue"]] : nil; NSData *notesTextData = [[self notesString] dataUsingEncoding:NSUTF8StringEncoding]; NSData *notesRTFData = [self notesRTFData]; NSFileWrapper *fileWrapper = [[NSFileWrapper alloc] initDirectoryWithFileWrappers:[NSDictionary dictionary]]; [fileWrapper addRegularFileWithContents:pdfData preferredFilename:WRAPPER_PDF_FILENAME]; + if (textData) + [fileWrapper addRegularFileWithContents:textData preferredFilename:WRAPPER_TEXT_FILENAME]; if (notesData) [fileWrapper addRegularFileWithContents:notesData preferredFilename:WRAPPER_SKIM_FILENAME]; if (notesTextData) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit