[MacRuby-devel] PDFKit status?

Yasu Imao yimao.ml at gmail.com
Sun Dec 5 16:27:11 PST 2010


Hi,

I'm wondering what the status of using PDFKit in MacRuby.  Should it be fully usable now?  I encountered a possible bug.  


framework 'cocoa'
framework 'Quartz'

path = <whatever the path to a pdf file>

pdfDoc = PDFDocument.alloc.initWithURL(NSURL.fileURLWithPath(path))
selections = pdfDoc.findString("the",withOptions:NSCaseInsensitiveSearch)
selections.each do |selection|
  p selection.string
end

=> NSInvalidArgumentException: -[CPCharacterIndex count]: unrecognized selector sent to instance 0x200915a80 (RuntimeError Error)


The PDF I used is an academic journal article PDF with about 12000 words.  This occurred at different positions in the PDF file every time.  Sometimes this happens earlier in the loop and sometimes later.  This did run a few times without error (rarely, though).  Whether or not to add .string didn't matter.  The same process works without any problem with RubyCocoa.


Best,
Yasu


More information about the MacRuby-devel mailing list