From my point of view, is better to leave the writing position unaffected, if a field is empty or excluded from display.

So you have to make this check in drawContent function before the call of SetX, SetY functions.

Comments

I second this behaviour too, in my case some fields are not displayed (which is the intended behaviour if they are empty) but views pdf does take that invisible field as the last writing position, which results in strange results when positioning fields relatively.
I can submit a pdf showing this behaviour in case my explanation was not clear enough.

And thanks for such a great module, btw.

I second it as well. I have a content type with optional fields. But if they are left empty, I don't want the PDF content to leave empty space.

I'm trying to alter views_pdf_template.php -

I have tried several things, including at line 344

$this->SetX($x);
$this->SetY($y);
$this->renderRow($x, $y, $row, $options, $view, $key);

I have changed to:

if ($view->field[$key]) {
$this->SetX($x);
$this->SetY($y);
$this->renderRow($x, $y, $row, $options, $view, $key);
}

To check whether the field is empty. And it makes no difference. Can someone point me in the right direction?

Thanks

This works:

if ($view->field[$key]->theme($row)) {
$this->SetX($x);
$this->SetY($y);
$this->renderRow($x, $y, $row, $options, $view, $key);
}

I would submit a patch, but 6.x-1.x-dev isn't listed on the Version control page. Is 6.x-1.x-dev the current release?

Version:6.x-1.x-dev» 6.x-1.0
StatusFileSize
new666 bytes

Here is the patch for 6.x-1.0

This patch is to be used with drush make (a default strip of -p0).

worked wonderfully, thanks a lot @lollypic!

Same problem exists in Drupal 7 I have applied the fix but no luck for me. Any ideas?

Version:6.x-1.0» 7.x-1.x-dev
Category:feature» bug
Status:Active» Patch (to be ported)

Committed, thanks!
Moving to 7.x-1.x.

Great news.

Status:Patch (to be ported)» Needs review
StatusFileSize
new624 bytes

Patch for 7.x-1.x, for those wanting to help test the module.

Priority:Normal» Critical
Status:Needs review» Needs work

This patch have to be commited. Putting in needs works, and make a review on it.

Priority:Critical» Major
Status:Needs work» Fixed

Priority:Major» Normal

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.