2

How to change name for PDF output in PRINT module, for each module separately? Can I use a some sort of hook for it? Any help?

Laky
  • 745
  • 2
  • 12
  • 25

2 Answers2

1

The Print module includes a drupal_alter function in print_pdf.page.inc

drupal_alter('print_pdf_filename', $pdf_filename, $path);

This results in the following hook being available for use:

function hook_print_pdf_filename_alter(&$pdf_filename, $path) {
  $pdf_filename = 'yourfilename';
}
Terri-Anne
  • 11
  • 1
0

I could not find a hook but I did manage to find the variable for it.

I had a look at the module and it seems it is setting the name at line 41 page print.pdf.pages.inc.

$pdf_filename = variable_get('print_pdf_filename',
PRINT_PDF_FILENAME_DEFAULT);

So try this and put this code in your module. I am not sure if it will work

variable_set('print_pdf_filename', $nameouwant);

cheers, Vishal

Vishal Khialani
  • 2,557
  • 6
  • 38
  • 49