Project

General

Profile

Actions

Patch #10464

closed

Enhanced PDF output for Issues list

Added by Yuri Makarov about 12 years ago. Updated about 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
PDF export
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

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.


Files

pdf.diff (9.09 KB) pdf.diff Yuri Makarov, 2012-03-16 09:26
example-1.pdf (17.6 KB) example-1.pdf Yuri Makarov, 2012-03-16 10:47
example-2.pdf (329 KB) example-2.pdf Yuri Makarov, 2012-03-16 10:47
example-3.pdf (14.5 KB) example-3.pdf Yuri Makarov, 2012-03-16 10:47
pdf-r9240.diff (9.98 KB) pdf-r9240.diff Toshi MARUYAMA, 2012-03-17 06:36
issues-pdf-r9244.diff (10.2 KB) issues-pdf-r9244.diff Toshi MARUYAMA, 2012-03-18 09:02
grouped-issues.pdf (416 KB) grouped-issues.pdf Toshi MARUYAMA, 2012-03-18 09:30
first-row.png (13 KB) first-row.png Toshi MARUYAMA, 2012-03-18 09:30
pdf-1.diff (9.67 KB) pdf-1.diff Yuri Makarov, 2012-03-19 11:37
pdf-issues-alignment.diff (1.54 KB) pdf-issues-alignment.diff Toshi MARUYAMA, 2012-03-20 08:15

Related issues

Related to Redmine - Defect #10554: Defect symbols when exporting tasks in pdfClosedToshi MARUYAMA

Actions
Actions #2

Updated by Toshi MARUYAMA about 12 years ago

This is a patch rebased on trunk r9240.

Actions #3

Updated by Toshi MARUYAMA about 12 years ago

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

Actions #4

Updated by Toshi MARUYAMA about 12 years ago

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

Actions #5

Updated by Yuri Makarov about 12 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

Actions #6

Updated by Toshi MARUYAMA about 12 years ago

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

Actions #7

Updated by Yuri Makarov about 12 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.

Actions #8

Updated by Yuri Makarov about 12 years ago

Updated

Actions #9

Updated by Terence Mill about 12 years ago

+1

Actions #10

Updated by Toshi MARUYAMA about 12 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.

Actions

Also available in: Atom PDF