Patch #10464

Enhanced PDF output for Issues list

Added by Yuri Makarov over 5 years ago. Updated over 5 years ago.

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

0%

Category:PDF export
Target version:1.4.0

Description

Improvements:

1. Automatic calculation of the size of table columns depending on their content.
2. Automatic detection of columns alignment.
3. Output table header on each page.

pdf.diff Magnifier (9.09 KB) Yuri Makarov, 2012-03-16 09:26

example-1.pdf (17.6 KB) Yuri Makarov, 2012-03-16 10:47

example-2.pdf (329 KB) Yuri Makarov, 2012-03-16 10:47

example-3.pdf (14.5 KB) Yuri Makarov, 2012-03-16 10:47

pdf-r9240.diff Magnifier (9.98 KB) Toshi MARUYAMA, 2012-03-17 06:36

issues-pdf-r9244.diff Magnifier (10.2 KB) Toshi MARUYAMA, 2012-03-18 09:02

grouped-issues.pdf (416 KB) Toshi MARUYAMA, 2012-03-18 09:30

first-row.png (13 KB) Toshi MARUYAMA, 2012-03-18 09:30

pdf-1.diff Magnifier (9.67 KB) Yuri Makarov, 2012-03-19 11:37

pdf-issues-alignment.diff Magnifier (1.54 KB) Toshi MARUYAMA, 2012-03-20 08:15


Related issues

Related to Redmine - Defect #10554: Defect symbols when exporting tasks in pdf Closed

Associated revisions

Revision 9246
Added by Toshi MARUYAMA over 5 years ago

pdf: enhanced issues list (#10464)

  • Automatic calculation of the size of table columns depending on their content
  • Output table header on each page

Contributed by Yuri Makarov.

History

#1 Updated by Yuri Makarov over 5 years ago

#2 Updated by Toshi MARUYAMA over 5 years ago

This is a patch rebased on trunk r9240.

#3 Updated by Toshi MARUYAMA over 5 years ago

This is a full patch for r9244 which fixes conflict and source indents.

#4 Updated by Toshi MARUYAMA over 5 years ago

Note 3 patch first row of second page height is broken.

#5 Updated by Yuri Makarov over 5 years ago

I can't test it now, my Redmine at work.

Some comments:
1. Comparing the diff's, I see in my pdf.rb line:
cv = issue.custom_values.detect {| v | ....
your version should be?:
cv = issue.custom_field_values.detect {| v | ....

2. Calculate the length of the text in my diff is based on the font page header. This is not correct. It almost does not affect the result, but leads to an increase in long columns of text. To correct this, use in def calc_col_width:
...
# by captions
pdf.SetFontStyle('B',8)
...

# by properties of issues
pdf.SetFontStyle('',8)
...

In this case, it may be necessary to add a constant of the column width for padding around the text, such as 5 mm.
col_padding = 5
col_width_min = query.columns.map {|v| pdf.GetStringWidth(v.caption) + col_padding}
...
x = pdf.GetStringWidth(w) + col_padding
...
n = pdf.GetStringWidth(v.rstrip) + col_padding
...
x = pdf.GetStringWidth(w) + col_padding

#6 Updated by Toshi MARUYAMA over 5 years ago

Please create a patch to the trunk.
I rebased your patch to the trunk.

#7 Updated by Yuri Makarov over 5 years ago

I can make a patch only tomorrow at work.

About first row of second page ..
Change from (about line 333 in trunk):

          # make new page if it doesn't fit on the current one
          space_left = page_height - base_y - bottom_margin
          if max_height > space_left
            pdf.AddPage("L")
            base_x = pdf.GetX
            base_y = pdf.GetY
            render_table_header(pdf, query, col_width, row_height, col_id_width, table_width)
          end

To:

          # make new page if it doesn't fit on the current one
          space_left = page_height - base_y - bottom_margin
          if max_height > space_left
            pdf.AddPage("L")
            render_table_header(pdf, query, col_width, row_height, col_id_width, table_width)
            base_x = pdf.GetX
            base_y = pdf.GetY
          end

This should fix the result.

#8 Updated by Yuri Makarov over 5 years ago

Updated

#9 Updated by Terence Mill over 5 years ago

+1

#10 Updated by Toshi MARUYAMA over 5 years ago

I committed r9246 to the trunk.
This commit is removed auto alignment.
I attach a patch for auto alignment.
I do not see the reason to change alignment.

Also available in: Atom PDF