I'm trying to get Page number in my footer, and some text in the header.

The header appears on some pages, not on others...

And how do i put something in the footer? the choice in PDF fields say 'In Header/Footer' without an ability to stipulate which.

Any help much appreciated!

#2 1886066-header_footer-2.patch1.93 KBguillaumev
Members fund testing for the Drupal project. Drupal Association Learn more


gillarf’s picture

here's an example of the PDF:


I worked out how to put content in the footer, but on some pages neither the header nor the footer appear.

guillaumev’s picture

Title: Odd behaviour with headers and footers - need support » Print views header and footer in PDF
Status: Active » Needs review
1.93 KB

This patch prints the views header and footer in the PDF on every page. I believe it makes much more sense to use these as Header and Footer instead of trying to print the header and footer from fields...

killua99’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

Works fine, as you say. well done!

Info for the maintainer:
Exist a patch to handle this issues and others. Please see #2032189-4: Multiple issue fixing in a single patch: Multiple issue fixing in a single patch and review others issues patch.

This is RTBC, and ready to apply.

killua99’s picture

Priority: Major » Normal
Status: Reviewed & tested by the community » Fixed

Thanks guillaumev committed

candelas’s picture

Status: Fixed » Active

i am using the pdf unformatted in the module dev version and if i add something to the header or footer, it is not written.
if i add a field to the header and footer in the field settings, first field gets duplicated. the same if i put a number field in the footer and header.

if i put something in the header/footer area i get an extra page.

killua99’s picture

Priority: Normal » Major
Status: Active » Needs work

Ok, so. Looks like it's not completely done.

Can you use the git branch 7.x-1.x and make an update of that branch. When you do it, please summit if this still happen. I tried and looks fine for me at least.

candelas’s picture

i tried the last version and now i get footer and header from views, but if i use tokens i get
Fatal error: Call to a member function tokenize_value() on a non-object in /xxx/sites/all/modules/contrib/views/handlers/views_handler_area_text.inc on line 105

since in this version i keep having problems on puting the number in the footer, i was trying to use the views footer to write the number (i created the field and excluded from display).

killua99’s picture

Ok, Yes the version 6 I see have some issue with the tokens. Maybe it's the same here

nhck’s picture

@@ -151,7 +163,10 @@ class PdfTemplate extends FPDI {
+    $this->SetY(-$this->bMargin);

The problem is that $this->bMargin always seems to be zero.

nhck’s picture

As an additional source of possible errors I have identified that the whole view should be rendered before the footer and header are renderered. The reason is that some fields in the footer rely on content from the whole view. For example the order total field of commerce. I'd hence suggest to fully render the view before rendering the footer or the header:

    //views_pdf_plugin_display.inc line 111  

$html = $this->view->render($this->display->id); //it must be in the middle for header AND footer to correctly parse.
killua99’s picture

Category: support » bug

Ok, This week I'm kind busy.

Next one I'll start digg into this one.

cdeces’s picture

In order to have headers and footers written on each page, a checkPageBreak() should be used after writing each record.

alibama’s picture

Issue summary: View changes

patch didn't apply well to latest dev - any ideas? I'm not able to use this module at present

vegansupreme’s picture

@alibama, What specifically isn't working for you? Patch has already been applied in latest dev, and stable versions. See #4.
Headers/footers do work in PDF, but not perfectly.
Also, there are issues when using tokens in headers/footers. See #2099263: Unable to use tokens with Views PDF

vegansupreme’s picture

Status: Needs work » Closed (fixed)