Hi Yasu,
I tried your sample with a large pdf in my environment a few times and it never
crashed. But I suspect the exception you're getting is due to a memory problem,
maybe related to the GC.
Can you try setting the GC_DISABLE environment variable to 1 when running the
script?
If it doesn't crash anymore it's probably not a bug in MacRuby then. I would
try to rewrite the sample in pure Objective-C and see if the crash persists.
Laurent
On Dec 5, 2010, at 4:27 PM, Yasu Imao wrote:
> 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
> _______________________________________________
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel