You are here

function _drush_print_pdf_download_url in Printer, email and PDF versions 7

Same name and namespace in other branches
  1. 6 print_pdf/print_pdf.drush.inc \_drush_print_pdf_download_url()

Discover the correct URL of the package to download

1 call to _drush_print_pdf_download_url()
drush_print_pdf_download in print_pdf/print_pdf.drush.inc
Download and extract PDF archive.

File

print_pdf/print_pdf.drush.inc, line 104
drush integration for print_pdf module PDF libraries download.

Code

function _drush_print_pdf_download_url($library) {
  $ret = FALSE;
  switch (drupal_strtolower($library)) {
    case 'dompdf':
      $ret = DOMPDF_DOWNLOAD_URI;
      break;
    case 'tcpdf':
      $ret = TCPDF_DOWNLOAD_URI;
      break;
    case 'wkhtmltopdf':
      switch (drupal_substr(php_uname('s'), 0, 3)) {
        case 'Lin':
          $ret = php_uname('m') == 'x86_64' ? WKHTMLTOPDF_AMD64_DOWNLOAD_URI : WKHTMLTOPDF_I386_DOWNLOAD_URI;
          break;
        case 'Win':
          $ret = WKHTMLTOPDF_WIN_DOWNLOAD_URI;
          break;
        case 'Dar':
          $ret = WKHTMLTOPDF_OSX_DOWNLOAD_URI;
          break;
        default:
          drush_log(dt('wkhtmltopdf is not supported in this system, please choose another library.'), 'error');
          break;
      }
      break;
    default:
      drush_log(dt('Unknown PDF library specified, please use one of the supported PDF libraries.'), 'error');
      break;
  }
  return $ret;
}