You are here

function get_new_pdf_page in Recipe 6

1 call to get_new_pdf_page()
get_pdf_pages in plugins/recipe_pdf35.module

File

plugins/recipe_pdf35.module, line 483
recipe_pdf35.module - Enables exporting of 3x5" cards in pdf format. This is incredibly rudimentary at this point. 1 and only 1 card and if you go over, the text is lost.

Code

function get_new_pdf_page($recipe_data) {
  $page = array(
    'header' => array(),
    'footer' => array(),
    'column_0' => array(),
    'column_1' => array(),
    'column_2' => array(),
  );

  // The page header.
  if (strlen($recipe_data['recipe_title']) < 48) {
    $recipe_title = wrap_and_pdf_escape($recipe_data['recipe_title'], 48);
    $recipe_title = join(" ", $recipe_title);
    $obj = "BT /F1 14 Tf 12 TL 20 200 Td {$recipe_title} ET";
    $len = strlen($obj);
    $obj = "<< /Length {$len} >>\nstream\n{$obj}\nendstream";
    $page['header'][] = $obj;
  }
  else {
    $recipe_title = wrap_and_pdf_escape($recipe_data['recipe_title'], 70);
    $recipe_title = join(" ", $recipe_title);
    $obj = "BT /F1 10 Tf 12 TL 20 200 Td {$recipe_title} ET";
    $len = strlen($obj);
    $obj = "<< /Length {$len} >>\nstream\n{$obj}\nendstream";
    $page['header'][] = $obj;
  }
  return $page;
}