Opened 3 years ago

Closed 3 years ago

#2392 closed Bug (fixed)

PDF reports - long lines overflow into adjacent cell, or truncated [patch]

Reported by: n0v1 Owned by:
Priority: low Milestone: 1.6 Piwik 1.6
Component: Core Keywords:
Cc: Sensitive: no

Description

Small display error in PDF reports. If text is too long for one cell it will sometimes (if cell has no background colour?) flow in adjacent cell and make content unreadable. Happened for Visitor overview and Returning Visitors report. See attached screenshots.

Also mentioned in http://forum.piwik.org/read.php?5,76084

Attachments (2)

display-bug-pdf-report-visitor-overview.jpg (33.7 KB) - added by n0v1 3 years ago.
display-bug-pdf-report-returning-visitors.jpg (34.3 KB) - added by n0v1 3 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 3 years ago by vipsoft (robocoder)

  • Keywords pdf reports removed
  • Milestone set to 1.5 - Piwik 1.5

I think this is the flip side of #1601.

comment:2 Changed 3 years ago by vipsoft (robocoder)

  • Summary changed from Display error in PDF reports with too long lines flowing in adjacent cell to PDF reports - long lines overflow into adjacent cell, or truncated

comment:3 Changed 3 years ago by matt (mattab)

  • Milestone changed from 1.5 - Piwik 1.5 to Feature requests

I don't think it's easy to do, or maybe I just don't know about it... ? Decreasing priority but of course if a patch is submitted it would be great :)

comment:4 Changed 3 years ago by matt (mattab)

Maybe worth trying to replace Cell() by MultiCell() in the generation code (see http://stackoverflow.com/questions/2938953/word-wrap-in-tcpdf )

comment:5 Changed 3 years ago by krom

Setting a a white background on the even rows, like the green on the uneven, will do the trick. This will hide the overflowing text.
But it might be a better idea to make the cells wider, there's plenty of room left.

comment:6 in reply to: ↑ description Changed 3 years ago by mattenschwinger

Quick and dirty fix is the following configuration:

/core/ReportRenderer/Pdf.php

//line 29
	private $bottomMargin = 15;
	private $reportWidthPortrait = 195;
	private $reportWidthLandscape = 270;
	private $minWidthLabelCell = 100;
	private $maxColumnCountPortraitOrientation = 6;
	private $truncateAfter = 55;

Line 326 Computes available column width

		// Computes available column width
		$this->totalWidth = $totalWidth;
//		$this->labelCellWidth = max(round(($this->totalWidth / $columnsCount) * 2), $this->minWidthLabelCell);
// 		Changed by Jens Verneuer
		$this->labelCellWidth = max(round(($this->totalWidth / $columnsCount) ), $this->minWidthLabelCell);
		if ($columnsCount == 2) {
// 		Changed by Jens Verneuer			
//		$this->labelCellWidth = $this->totalWidth / 2;
		}
		$this->cellWidth = round(($this->totalWidth - $this->labelCellWidth) / ($columnsCount - 1));
		$this->totalWidth = $this->labelCellWidth + ($columnsCount - 1) * $this->cellWidth;

Additionaly I decreased the Font Size a bit, because some of our Website Names are to long for the first Paper of the Report
Line 27/28:

	private $reportSimpleFontSize = 9;
	private $reportHeaderFontSize = 16;

works fine 4 us

comment:7 Changed 3 years ago by matt (mattab)

  • Milestone changed from Feature requests to 1.6 Piwik 1.6
  • Summary changed from PDF reports - long lines overflow into adjacent cell, or truncated to PDF reports - long lines overflow into adjacent cell, or truncated [patch]

comment:8 Changed 3 years ago by matt (mattab)

  • Milestone changed from 1.7 Piwik 1.7 to 1.6 Piwik 1.6

comment:9 Changed 3 years ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from new to closed

(In [5234]) Thanks mattenschwinger Fixes #2392

Note: See TracTickets for help on using tickets.