Defect #18630

PDF Export sets table width as 100% by default

Added by @ go2null about 8 years ago. Updated about 8 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:PDF export
Target version:-
Resolution: Affected version:2.6.0

Description

The new PDF gem sets unspecified table widths to 100%.

Please see attached screenshots.

This seems to be the relevant code.

# /usr/lib/ruby/gems/1.9.1/gems/rbpdf-1.18.2/lib/rbpdf.rb

3721 # [@param float :w] Width of cells. If 0, they extend up to the right margin of the page.
3764 def MultiCell(w, h, txt, border=0, align='J', fill=0, ln=1, x='', y='', reseth=true, stretch=0, ishtml=false, autopadding=true, maxh=0)

11964 # table width
11965 if !dom[key]['width'].nil?
11966  table_width = getHTMLUnitToUnits(dom[key]['width'], wtmp, 'px')
11967 else
11968  table_width = wtmp
11969 end

11995 table_columns_width = table_width - (cellspacing * (dom[table_el]['cols'] - 1))
11996 wtmp = colspan * (table_columns_width / dom[table_el]['cols']) + (colspan - 1) * cellspacing
11997 if !dom[key]['width'].nil?
11998   cellw = getHTMLUnitToUnits(dom[key]['width'], table_columns_width, 'px')
11999 else
12000   cellw = wtmp
12001 end

12089 MultiCell(cellw, cellh, cell_content, 0, lalign, 0, 2, '', '', true, 0, true)

html.png (9.08 KB) @ go2null, 2014-12-12 20:05

rbpdf.png (11.8 KB) @ go2null, 2014-12-12 20:05

History

#1 Updated by Toshi MARUYAMA about 8 years ago

Also available in: Atom PDF