I've written a small script that can be used to quickly test/iterate, for anyone out there who wants to try a fix. I am not a Ruby dev and there are no build instructions for this repo so I just slapped this together:
Build Environment
Project files:
main.rb
./prawn-table/ <----- clone of this repo
To rebuild the Gem with your changes, and rebuild the PDF:
cd ./prawn-table
rm prawn-table-*.gem && gem build prawn-table.gemspec
cd -
ruby main.rb
Contents of main.rb:
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'prawn'
gem 'prawn-table', :path => './prawn-table'
end
Prawn::Document.generate('result.pdf') do
data = [ ["TOP", "", ""], ]
table data, :cell_style => { :valign => :top}
move_down 20
data = [ ["CENTER", "", ""], ]
table data, :cell_style => { :valign => :center}
move_down 20
data = [ ["BOTTOM", "", ""], ]
table data, :cell_style => { :valign => :bottom}
move_down 20
end
Valign does not work.
:top
ends up centered,:center
ends up at the bottom, and:bottom
ends up at the bottom correctly.The original valign code was added in prawn:5cddc78a
I've written a small script that can be used to quickly test/iterate, for anyone out there who wants to try a fix. I am not a Ruby dev and there are no build instructions for this repo so I just slapped this together:
Build Environment
Project files:
To rebuild the Gem with your changes, and rebuild the PDF:
Contents of
main.rb
:Results
The current codebase results in the following:![image](https://user-images.githubusercontent.com/4392850/132140092-02bf562a-413a-47d9-ad56-7488e8a4eacd.png)
Simply commenting out prawn/table/cell/text.rb line 69 gives a better result in my opinion:![image](https://user-images.githubusercontent.com/4392850/132140100-80b97b1f-abf3-4ae4-9cb3-ec368c277a68.png)