Index: lib/redmine/export/pdf.rb =================================================================== --- lib/redmine/export/pdf.rb (revision 12012) +++ lib/redmine/export/pdf.rb (working copy) @@ -524,6 +524,16 @@ pdf.Line(top_x, lower_y, col_x, lower_y) # bottom border end + # Render issue header + def issue_to_pdf_write_header(pdf, style, w, h, value, base_y, max_height) + col_x = pdf.GetX + pdf.SetFontStyle(style,9) + pdf.RDMMultiCell(w, h, value, 0, '', 0, 1) + max_height = (pdf.GetY - base_y) if (pdf.GetY - base_y) > max_height + pdf.SetXY(col_x + w, base_y) + return max_height + end + # Returns a PDF string of a single issue def issue_to_pdf(issue, assoc={}) pdf = ITCPDF.new(current_language) @@ -577,20 +587,38 @@ end rows = left.size > right.size ? left.size : right.size + + label_width = 36 + value_width = 59 + row_height = 5 + + top_x = pdf.GetX + top_y = pdf.GetY + rows.times do |i| + base_y = pdf.GetY + max_height = row_height + item = left[i] - pdf.SetFontStyle('B',9) - pdf.RDMCell(35,5, item ? "#{item.first}:" : "", i == 0 ? "LT" : "L") - pdf.SetFontStyle('',9) - pdf.RDMCell(60,5, item ? item.last.to_s : "", i == 0 ? "RT" : "R") + max_height = issue_to_pdf_write_header(pdf, 'B', label_width, row_height, item ? "#{item.first}:" : "", base_y, max_height) + max_height = issue_to_pdf_write_header(pdf, '', value_width, row_height, item ? item.last.to_s : "", base_y, max_height) item = right[i] - pdf.SetFontStyle('B',9) - pdf.RDMCell(35,5, item ? "#{item.first}:" : "", i == 0 ? "LT" : "L") - pdf.SetFontStyle('',9) - pdf.RDMCell(60,5, item ? item.last.to_s : "", i == 0 ? "RT" : "R") - pdf.Ln + max_height = issue_to_pdf_write_header(pdf, 'B', label_width, row_height, item ? "#{item.first}:" : "", base_y, max_height) + max_height = issue_to_pdf_write_header(pdf, '', value_width, row_height, item ? item.last.to_s : "", base_y, max_height) + + pdf.SetY(base_y + max_height) end + + w_half = label_width + value_width + w = w_half * 2 + lower_y = pdf.GetY + + # Draw header border + pdf.Line(top_x, top_y, top_x + w, top_y) + pdf.Line(top_x, top_y, top_x, lower_y) + pdf.Line(top_x + w_half, top_y, top_x + w_half, lower_y) + pdf.Line(top_x + w, top_y, top_x + w, lower_y) pdf.SetFontStyle('B',9) pdf.RDMCell(35+155, 5, l(:field_description), "LRT", 1)