Table is missing and appears to interrupt generation without errors in embedded Ruby (Sketchup)
Hi,
I'm developing Plugins for Sketchup, which uses its own embedded ruby interpreter (2.0.0 p247) and API to allow communication with the core software.
While looking for a pdf generator suitable to export reports, I've found prawn to be very interesting and first tests are promising. However, we need to include some tables, and there appears to be a problem that with the generation, but no errors are shown while the incomplete pdf file is created. It also appears to interrupt the process somehow, elements after the table are missing too.
require 'prawn'
require 'prawn/table'
Prawn::Document.generate("test.pdf") do
text "hello"
table([["foo", "bar " * 10, "baz"],["baz", "bar", "foo " * 10]])
text "world"
end
system `start test.pdf`
This works fine when run in ruby locally , but does only print
hello
when executed in Sketchup.
Are there any debug options I can use to get more feedback and help you with looking what causes this problem?
A bit more information I could gather myself:
Storing the table with make_table in a variable, I get this output when I use pretty-print. When I don't call draw it prints the world correctly, with draw I get the incorrect output of my previous example.
I did the same for the document itself: output
@SvenPetroll I have no experience with SketchUp. Could you please write a short instruction how one like me might reproduce the issue?
As for debug option. There's none in Prawn-Table I know of. Maybe using Ruby's debug options would help. Check Ruby pre-defined variables documentation for $DEBUG and $VERBOSE. Maybe that would give you more information.
- Download a Sketchup version suitable to your system, I'm using Sketchup 2016 Pro x64 which has a trial, but you can download Sketchup 2016 Make for free.
- Start Sketchup, toggle the Ruby Console with
Windows -> Ruby Console - Install prawn into the embedded ruby by using
Gem.install 'prawn'andGem.install 'prawn-table' - Put this file into
AppData\Roaming\SketchUp\SketchUp 2016\SketchUp\Pluginson Windows, orLibrary > Application Support > SketchUp 2016 > SketchUp > Pluginson Mac, you may need to create the Plugins folder - Restart Sketchup, a new menu item should appear under
Extensions, which will generate the pdf file - Alternatively, you can use the Ruby Console similarly to
irb.