You are here

function print_pdf_generate_html in Printer, email and PDF versions 7.2

Same name and namespace in other branches
  1. 6 print_pdf/print_pdf.pages.inc \print_pdf_generate_html()
  2. 7 print_pdf/print_pdf.pages.inc \print_pdf_generate_html()
  3. 5.x print_pdf/print_pdf.pages.inc \print_pdf_generate_html()

Generate a PDF version of the provided HTML.

Parameters

string $html: HTML content of the PDF.

array $meta: Meta information to be used in the PDF

  • url: original URL
  • name: author's name
  • title: Page title
  • node: node object.

string $filename: (optional) Filename of the generated PDF.

string $paper_size: (optional) Paper size of the generated PDF.

string $page_orientation: (optional) Page orientation of the generated PDF.

Return value

string|null generated PDF page, or NULL in case of error

See also

print_pdf_controller()

Related topics

1 call to print_pdf_generate_html()
print_pdf_generate_path in print_pdf/print_pdf.pages.inc
Gennerate a PDF for a given Drupal path.

File

print_pdf/print_pdf.module, line 478
Displays Printer-friendly versions of Drupal pages.

Code

function print_pdf_generate_html($html, $meta, $filename = NULL, $paper_size = NULL, $page_orientation = NULL) {
  $pdf_tool = explode('|', variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT));
  module_load_include('inc', $pdf_tool[0], $pdf_tool[0] . '.pages');
  $function = $pdf_tool[0] . '_print_pdf_generate';
  $pdf = function_exists($function) ? $function($html, $meta, $paper_size, $page_orientation) : NULL;
  if ($filename) {
    return print_pdf_dispose_content($pdf, $filename);
  }
  return $pdf;
}