You are here

function pdf_using_mpdf_library_exist in PDF using mPDF 7

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

Function to check existence of mPDF library.

Return value

bool TRUE if mPDF library path exists and FALSE if it isn't.

4 calls to pdf_using_mpdf_library_exist()
pdf_using_mpdf_api in ./pdf_using_mpdf.module
API to generate a PDF file.
pdf_using_mpdf_config in ./pdf_using_mpdf.admin.inc
Admin configure form control on page.
pdf_using_mpdf_config_validate in ./pdf_using_mpdf.admin.inc
Configuration form Validation check.
pdf_using_mpdf_generate_pdf in ./pdf_using_mpdf.pages.inc
Generate HTML of a given node.

File

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

Code

function pdf_using_mpdf_library_exist() {
  $tools = array();

  // Search for mpdf tool first.
  $pattern = '/^mpdf.php$/';

  // Libraries module to detect mPDF library in case of multisite installation.
  $tools = array_keys(file_scan_directory(libraries_get_path('mpdf'), $pattern));

  // mPDF library looked for in the module directory itself.
  $tools = array_merge($tools, array_keys(file_scan_directory(drupal_get_path('module', 'pdf_using_mpdf'), $pattern)));
  if (isset($tools[0])) {
    require_once $tools[0];
    return TRUE;
  }
  else {
    return FALSE;
  }
}