You are here

function _webform2pdf_init_tcpdf in Webform2PDF 6

Same name and namespace in other branches
  1. 6.2 webform2pdf.module \_webform2pdf_init_tcpdf()
  2. 7.4 includes/webform2pdf.theme.inc \_webform2pdf_init_tcpdf()
  3. 7.3 webform2pdf.module \_webform2pdf_init_tcpdf()
1 call to _webform2pdf_init_tcpdf()
theme_webform2pdf_pdf_init in ./webform2pdf.module

File

./webform2pdf.module, line 1595

Code

function _webform2pdf_init_tcpdf($node, $template) {
  global $base_url;
  $default = variable_get('webform2pdf_default', '');
  define('K_TCPDF_EXTERNAL_CONFIG', TRUE);
  define('K_PATH_MAIN', dirname($_SERVER['SCRIPT_FILENAME']));
  define('K_PATH_URL', $base_url);
  define('K_PATH_FONTS', $default['pdf_lib'] . '/fonts/');
  define('K_PATH_CACHE', $default['pdf_lib'] . '/cache/');
  define('K_PATH_IMAGES', '');
  define('K_BLANK_IMAGE', $default['pdf_lib'] . '/images/_blank.png');
  define('K_CELL_HEIGHT_RATIO', 1.25);
  define('K_SMALL_RATIO', 2 / 3);
  if (is_file($default['pdf_lib'] . '/tcpdf.php')) {
    include_once drupal_get_path('module', 'webform2pdf') . '/webform2pdf.class.inc';
    $font = array(
      variable_get('print_pdf_font_family', PRINT_PDF_FONT_FAMILY_DEFAULT),
      '',
      variable_get('print_pdf_font_size', PRINT_PDF_FONT_SIZE_DEFAULT),
    );

    // create new PDF document
    $pdf = new W2PDF($template['page_orientation'], 'mm', $template['page_format'], TRUE);

    // set document information
    $pdf
      ->SetCreator(variable_get('site_name', 'Drupal'));
    $pdf
      ->SetAuthor($node->name);
    $pdf
      ->SetTitle($node->title);
    $pdf
      ->setPDFVersion('1.6');
    return $pdf;
  }
  else {
    return;
  }
}