@state ||= 0
@tableborder ||= 0
@tdbegin ||= false
+ @tdtext ||= ''
@tdwidth ||= 0
@tdheight ||= 0
@tdalign ||= "L"
else
#Text
- if (@href)
+ if (@tdbegin)
element.gsub!(/[\t\r\n\f]/, "");
- addHtmlLink(@href, element, fill);
- elsif (@tdbegin)
+ @tdtext << element.gsub(/ /, " ");
+ elsif (@href)
element.gsub!(/[\t\r\n\f]/, "");
- element.gsub!(/ /, " ");
- base_page = @page;
- base_x = @x;
- base_y = @y;
-
- MultiCell(@tdwidth, @tdheight, unhtmlentities(element.strip), @tableborder, @tdalign, @tdfill, 1);
- tr_end = @t_cells[@table_id][@tr_id][@td_id]['j1'] + 1;
- if @max_td_page[tr_end].nil? or (@max_td_page[tr_end] < @page)
- @max_td_page[tr_end] = @page
- @max_td_y[tr_end] = @y
- elsif (@max_td_page[tr_end] == @page)
- @max_td_y[tr_end] = @y if @max_td_y[tr_end].nil? or (@max_td_y[tr_end] < @y)
- end
-
- @page = base_page;
- @x = base_x + @tdwidth;
- @y = base_y;
+ addHtmlLink(@href, element, fill);
elsif (@pre_state == true and element.length > 0)
Write(@lasth, unhtmlentities(element), '', fill);
elsif (element.strip.length > 0)
@x += 5;
when 'table'
+ Ln();
if @default_table_columns < @max_table_columns[@table_id]
@table_columns = @max_table_columns[@table_id];
else
when 'img'
if (!attrs['src'].nil?)
+ # Don't generates image inside table tag
+ if (@tdbegin)
+ @tdtext << attrs['src'];
+ return
+ end
# Only generates image include a pdf if RMagick is avalaible
unless Object.const_defined?(:Magick)
Write(@lasth, attrs['src'], '', fill);
Ln();
when 'td','th'
+ base_page = @page;
+ base_x = @x;
+ base_y = @y;
+
+ MultiCell(@tdwidth, @tdheight, unhtmlentities(@tdtext.strip), @tableborder, @tdalign, @tdfill, 1);
+ tr_end = @t_cells[@table_id][@tr_id][@td_id]['j1'] + 1;
+ if @max_td_page[tr_end].nil? or (@max_td_page[tr_end] < @page)
+ @max_td_page[tr_end] = @page
+ @max_td_y[tr_end] = @y
+ elsif (@max_td_page[tr_end] == @page)
+ @max_td_y[tr_end] = @y if @max_td_y[tr_end].nil? or (@max_td_y[tr_end] < @y)
+ end
+
+ @page = base_page;
+ @x = base_x + @tdwidth;
+ @y = base_y;
+ @tdtext = '';
@tdbegin = false;
@tdwidth = 0;
@tdheight = 0;
@l_margin -= 5;
@r_margin -= 5;
@tableborder=0;
- Ln();
@table_id += 1;
when 'strong'