Project

General

Profile

the exported PDF Can't display the right layout

Added by yu xiaohang almost 11 years ago

dear develpoer of redmine

I got a problem when i exporting pdf file of an issue content, a Customized field using "Long text" format can't be displayed properly,just like picture below:

pic.png

how to get the right layout with no system version upgrade

Could someone please help me to fix this problem ,thanks !


Replies (2)

RE: the exported PDF Can't display the right layout - Added by cunhua kang over 10 years ago

i use redmine 2.3,got this problem too。
when i googled a few time,i overwrite “lib\redmine\export\pdf.rb” to dealwith it;
but i'm a beginner of ruby,just study from google,and only could write some english worlds,so ,this is a temporary solution;
for more help,my QQ is 358608208;email: ;
------------
follow this:

  • custom a longtxt field with "$" start: "$pm";
  • set longtxt field not display when it's output properties ;
  • set longtxt field display when it's after output description;

modify code list:
find code1:

        half = (issue.custom_field_values.size / 2.0).ceil
        issue.custom_field_values.each_with_index do |custom_value, i|
              (i < half ? left : right) << [custom_value.custom_field.name, show_value(custom_value)]          
        end

modify to:
        half = (issue.custom_field_values.size / 2.0).ceil
        issue.custom_field_values.each_with_index do |custom_value, i|
            #############
            if custom_value.custom_field.name.include?"$" 
            else
              (i < half ? left : right) << [custom_value.custom_field.name, show_value(custom_value)]
          end
          #############
        end            

find code 2:
    pdf.SetFontStyle('B',9)
        pdf.RDMCell(35+155, 5, l(:field_description), "LRT", 1)
        pdf.SetFontStyle('',9)
        # Set resize image scale
        pdf.SetImageScale(1.6)
        pdf.RDMwriteHTMLCell(35+155, 5, 0, 0,
              issue.description.to_s, issue.attachments, "LRB")

modify to:
        pdf.SetFontStyle('B',9)
        pdf.RDMCell(35+155, 5, l(:field_description), "LRT", 1)
        pdf.SetFontStyle('',9)
        # Set resize image scale
        pdf.SetImageScale(1.6)
        pdf.RDMwriteHTMLCell(35+155, 5, 0, 0,
              issue.description.to_s, issue.attachments, "LRB")
##########
                issue.custom_field_values.each_with_index do |custom_value, i|
            if custom_value.custom_field.name.include?"$"                
                 itemcusname = custom_value.custom_field.name
                 itemcusvalue = show_value(custom_value)
                 pdf.SetFontStyle('B',9)
                 pdf.RDMCell(35+155, 5, (itemcusname.to_s), "LRT", 1)
                 pdf.SetFontStyle('',8)
                 pdf.SetImageScale(1.6)
                 pdf.RDMMultiCell(35+155, 5, itemcusvalue.to_s)
            else

          end
          pdf.Ln
        end

######

RE: the exported PDF Can't display the right layout - Added by Jürgen Diez over 10 years ago

Thanks for this info.
Based on your solution I tried to fix it for all custom field and added a patch to bug report #13860.

    (1-2/2)