Thursday, June 3, 2010

PDF object dissection with macruby

irb(main):001:0> framework 'Quartz'
=> true
irb(main):002:0> url = NSURL.fileURLWithPath('/Users/Tim/Desktop/SU.pdf')
=> #<NSURL:0x2006e94a0>
irb(main):003:0> pdf = PDFDocument.alloc.initWithURL url
=> #<PDFDocument:0x2006cf5a0>
irb(main):006:0> select = pdf.findString("Shinya", withOptions:NSLiteralSearch)
irb(main):014:0> pdf.pageCount
=> 18
irb(main):014:0>

puts (PDFDocument.new.methods(true, true) - Object.new.methods(true, true)).sort

PDFDocumentPrintJobTitle
allowsCopying
allowsPrinting
annotationSubclassForClass
beginFindString:withOptions:
beginFindStrings:withOptions:
cancelFindString
cleanupAfterPrintOperation
cleanupFind
commonInit
coreFindString
coreFindStrings
createInfoDictionary
createPageArray
dataDetector
dataDetectorQueue
dataProvider
dataRepresentation
dataRepresentationWithOptions
delegate
didMatchString
documentAttributes
documentRef
documentURL
enqueueDataDetectionForPage:forPDFView:
exchangePageAtIndex:withPageAtIndex:
findOnPage
findString:fromSelection:withOptions:
findString:withOptions:
findStrings:withinSelection:withOptions:
formData
freePDFData
getNearestOutline:forDestination:
getPrintOperationForPrintInfo:autoRotate:
hasMarkupAnnotations
hasOpenPopupAnnotations
hasText
hasTextAnnotations
indexForPage
indexOfLastPageRemoved
initWithData
initWithPDFDocumentRef
initWithURL
insertPage:atIndex:
isEncrypted
isFinding
isLocked
majorVersion
minorVersion
normalizeFindOptions
originalPageCount
outlineItemForSelection
outlineRoot
pageAtIndex
pageClass
pageCount
pageForOriginalIndex
pageFromPageDictionary
pageSubrange
permissionsStatus
quickString
removePageAtIndex
scheduledFindOnPage
selectionForEntireDocument
selectionFromPage:atCharacterIndex:toPage:atCharacterIndex:
selectionFromPage:atPoint:toPage:atPoint:
setAutoRotate:forPrintOperation:
setDelegate
setDocumentAttributes
setDocumentRef
setOutlineRoot
setPageSubrange
setPrintScalingMode:forPrintOperation:
setUseCorePDF
string
unlockWithPassword
useCorePDF
writeToConsumer:withOptions:
writeToFile
writeToFile:withOptions:
writeToURL
writeToURL:withOptions:
=> nil


No comments: