[MacRuby-devel] PDFKit status?

Laurent Sansonetti lsansonetti at apple.com
Sun Dec 5 18:50:24 PST 2010


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
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20101205/ed598640/attachment.html>


More information about the MacRuby-devel mailing list