You are here

function pdf_using_mpdf_api in PDF using mPDF 7

Same name and namespace in other branches
  1. 7.2 pdf_using_mpdf.module \pdf_using_mpdf_api()

API to generate a PDF file.

Parameters

string $html: html is rendered HTML that will be converted into PDF.

string $pdf_using_mpdf_pdf_filename: pdf_using_mpdf_pdf_filename is Optional name of the PDF file.

Return value

bool TRUE if PDF is successfully generated and FALSE if it isn't.

File

./pdf_using_mpdf.module, line 298
Prints PDF for a given html node view.

Code

function pdf_using_mpdf_api($html, $pdf_using_mpdf_pdf_filename = NULL) {
  if (pdf_using_mpdf_library_exist() == TRUE) {
    if ($pdf_using_mpdf_pdf_filename === NULL) {
      $filename = explode(variable_get('pdf_using_mpdf_pdf_filename', 'PDF_USING_MPDF_PDF_DEFAULT_FILENAME'), '[site:name]');
      $pdf_using_mpdf_pdf_filename = token_replace($filename[0]);
    }
    _pdf_using_mpdf_generator($html, $pdf_using_mpdf_pdf_filename);
  }
  else {
    drupal_set_message(t('No mPDF Library Found in "sites/all/libraries" or "!default_module_path". Please download PHP mPDF PDF generation tool from <a href="http://www.mpdf1.com/">mPDF1.com</a>', array(
      '!default_module_path' => drupal_get_path('module', 'pdf_using_mpdf'),
    )), 'warning');
  }
}