Hello,

The module description says the following about background PDFs: "This static PDF can be exchanged dynamically by using a File Field." How do I achieve that?

I have a file field (PDF) on a content type and would like to generate a cover page for it with the node title via this module.

Thank you in advance!

Comments

vegansupreme’s picture

I've never used this feature. I just tried to do this and I'm getting an error.
Here's how I tried to do it.

  1. create a PDF Page views display
  2. add a field pick a file field that only uses PDFs
  3. click Format > Show PDF Fields > Settings
  4. Near the bottom of this panel there should be a drop down menu for Template PDF
  5. The machine name of your file field should appear in this menu.
  6. Select your field from this menu and click Apply.
  7. Save view and go to view's path.

The PDF templates don't show up, and you get the following error:
Notice: Undefined property: stdClass::$field_data_field_file_node_values in PdfTemplate::getTemplatePath() (line 992 of .../sites/all/modules/views_pdf/views_pdf_template.php).

I've never tried to use this feature before so maybe I'm doing it wrong.
Has anyone got this working?

maxneaga’s picture

vegansupreme,
Thank you, I'm also getting the same error.

Also I'm wondering why can't we select the attached file for the "Succeed PDF Template", as the only available option is "Template PDF" under Format -> Show -> PDF Fields -> Settings? I would like the file to be appended to the end of the generated PDF.

m-si’s picture

I got the same Probleme. Background PDF doesn't show up. Things I did

  1. create a PDF Page views display
  2. add a field (with only one PDF) brought in by a entity reference. choose formatter "generic file".
  3. click Format > Show PDF Fields > Settings
  4. Near the bottom of this panel there should be a drop down menu for Template PDF
  5. The machine name of your file field should appear in this menu.
  6. Select your field from this menu and click Apply.
  7. Save view and go to view's path.

no background PDF shows. The same file via upload in the dialog works as expected. I checkd the appreance of the file via another block view, so the entity reference works as expected. Addiotionally I brought in the file via the same field on the node form. PDF is not showing up.

I assume it simply dosent work even though the funtionality is promoted on the modules page. A possible resolution could be at least stop promoting this functionality...

vegansupreme’s picture

It seems @syndalis has been able to make this work in this issue:
#2332553: Get PDF Template URL from field?

Maybe this is different from that issue.

Looks like this is the problem code, but I'm not sure what's going on with it.

    if ($row != NULL && $view != NULL && !preg_match('/\.pdf/', $template)) {
      return drupal_realpath($row->field_data_field_file_node_values[0]['uri']);
    }

I suspect this worked properly at one time, but something broke it. I'll take a look at old code to see I can find a time when it worked.

May possibly be related to these issues:
#1936072: TCPDF ERROR: Unable to find pointer to xref table
#1146622: TCPDF ERROR: Unable to find pointer to xref table

vegansupreme’s picture

Does anyone know what's going on with this bit of code?
$row->field_data_field_file_node_values[0]['uri']
I don't understand how this is supposed to work. The Drupal 6 version of that line was:
$view->field[$template]->theme($row)

killua99’s picture

Status: Active » Closed (won't fix)