Project

General

Profile

Defect #14466 » pdf.rb.patch

Filou Centrinov, 2013-07-16 00:11

View differences:

lib/redmine/export/pdf.rb (working copy)
524 524
        pdf.Line(top_x, lower_y, col_x, lower_y)  # bottom border
525 525
      end
526 526

  
527
	  # Render issue header
528
      def issue_to_pdf_write_header(pdf, style, w, h, value, base_y, max_height)
529
        col_x = pdf.GetX
530
        pdf.SetFontStyle(style,9)
531
        pdf.RDMMultiCell(w, h, value, 0, '', 0, 1)
532
        max_height = (pdf.GetY - base_y) if (pdf.GetY - base_y) > max_height
533
        pdf.SetXY(col_x + w, base_y)	
534
        return max_height
535
      end
536

  
527 537
      # Returns a PDF string of a single issue
528 538
      def issue_to_pdf(issue, assoc={})
529 539
        pdf = ITCPDF.new(current_language)
......
577 587
        end
578 588

  
579 589
        rows = left.size > right.size ? left.size : right.size
590

  
591
        label_width = 36
592
        value_width = 59
593
        row_height  = 5
594

  
595
        top_x = pdf.GetX
596
        top_y = pdf.GetY
597
		
580 598
        rows.times do |i|
599
          base_y = pdf.GetY
600
          max_height = row_height
601

  
581 602
          item = left[i]
582
          pdf.SetFontStyle('B',9)
583
          pdf.RDMCell(35,5, item ? "#{item.first}:" : "", i == 0 ? "LT" : "L")
584
          pdf.SetFontStyle('',9)
585
          pdf.RDMCell(60,5, item ? item.last.to_s : "", i == 0 ? "RT" : "R")
603
          max_height = issue_to_pdf_write_header(pdf, 'B', label_width, row_height, item ? "#{item.first}:" : "", base_y, max_height)
604
          max_height = issue_to_pdf_write_header(pdf, '',  value_width, row_height, item ? item.last.to_s : "", base_y, max_height)
586 605

  
587 606
          item = right[i]
588
          pdf.SetFontStyle('B',9)
589
          pdf.RDMCell(35,5, item ? "#{item.first}:" : "", i == 0 ? "LT" : "L")
590
          pdf.SetFontStyle('',9)
591
          pdf.RDMCell(60,5, item ? item.last.to_s : "", i == 0 ? "RT" : "R")
592
          pdf.Ln
607
          max_height = issue_to_pdf_write_header(pdf, 'B', label_width, row_height, item ? "#{item.first}:" : "", base_y, max_height)
608
          max_height = issue_to_pdf_write_header(pdf, '',  value_width, row_height, item ? item.last.to_s : "", base_y, max_height)
609

  
610
          pdf.SetY(base_y + max_height)
593 611
        end
612
        
613
        w_half   = label_width + value_width
614
        w        = w_half * 2
615
        lower_y  = pdf.GetY
616

  
617
        # Draw header border
618
        pdf.Line(top_x,           top_y, top_x + w,      top_y) 
619
        pdf.Line(top_x,           top_y, top_x,          lower_y)
620
        pdf.Line(top_x + w_half,  top_y, top_x + w_half, lower_y)
621
        pdf.Line(top_x + w,       top_y, top_x + w,      lower_y)
594 622

  
595 623
        pdf.SetFontStyle('B',9)
596 624
        pdf.RDMCell(35+155, 5, l(:field_description), "LRT", 1)
(3-3/3)