Menu

no pdf output

Help
Tikaa
2014-03-05
2014-03-05
  • Tikaa

    Tikaa - 2014-03-05

    please delete. sorry for double posting

     

    Last edit: Tikaa 2014-03-05
    • Cristian Gómez

      Cristian Gómez - 2014-03-05

      Do you have the id property setted like that? without
      the double quotes?? Maybe that can be an issue, also try concatenating all
      the table HTML into $table string instead of make ob_get_clean (don't trust
      me in this but I think that other HTML output isn't well supported by tcpdf)

      /*****
      Don't Worry.......Be Linux!!!!
      Cristian Gómez Alvarez
      Ingeniero en Sistemas y Computación --- Universidad de Caldas
      Almera Information Management
      Comunidad de Software Libre Manizales
      Linux User #463617
      * Mi blog http://cristianpark.wordpress.com
      ******/

      2014-03-05 17:10 GMT-05:00 Tikaa tikaa@users.sf.net:

      i have this table generated by php and styled html inside patients.php
      file:

      <form name="pt_list" action="classes/MYPDF.php" method="post">
      <input type="submit" name="pt_pdf" value="Download as PDF">
      </form>





      <?php $x=1;
      foreach ($users as $patient) {

      ?>

      ['username'];?>"><?php echo $patient['username'];?>http://sourceforge.net/../profile.php?username=%3C?php%20echo%20$patient%3Cspan%3E['username']%3C/span%3E;?%3E
      <?php echo $patient['id'];?>
      <?php echo $patient['name'];?>
      <?php echo $patient['joined'];?>

      <?php $x++; } ?>

      Pt. username Pt. number Full Name Added on

      <?php$GLOBALS['table'] = ob_get_clean();$table = $GLOBALS['table'];
      ?>
      <?php

      echo $table;

      the table outputs fine on patients.php.i am trying to offer this table as
      a downloadable pdf for users but for the past few days i cant get it to
      output. here is what i tried in MYPDF.php:

      require_once('../tcpdf/tcpdf.php');require('../patients.php');

      // Extend the TCPDF class to create custom Header and Footer
      class MYPDF extends TCPDF {

      //Page headerpublic function Header() {
      // Logo
      $image_file = K_PATH_IMAGES.'logo_example.jpg';
      $this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
      // Set font
      $this->SetFont('helvetica', 'B', 20);
      // Title
      $this->Cell(0, 15, '<< TCPDF Example 003 >>', 0, false, 'C', 0, '', 0, false, 'M', 'M');}
      // Page footer
      public function Footer() {
      // Position at 15 mm from bottom
      $this->SetY(-15);
      // Set font
      $this->SetFont('helvetica', 'I', 8);
      // Page number
      $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');}

      }

      // create new PDF document
      $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true,
      'UTF-8', false);

      // set document information
      $pdf->SetCreator(PDF_CREATOR);
      $pdf->SetAuthor('Nicola Asuni');
      $pdf->SetTitle('TCPDF Example 003');
      $pdf->SetSubject('TCPDF Tutorial');
      $pdf->SetKeywords('TCPDF, PDF, example, test, guide');

      // set default header data
      $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH,
      PDF_HEADER_TITLE, PDF_HEADER_STRING);

      // set header and footer fonts
      $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
      $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

      // set default monospaced font
      $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

      // set margins
      $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
      $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
      $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

      // set auto page breaks
      $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

      // set image scale factor
      $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

      // set some language-dependent strings (optional)
      if (@file_exists(dirname(FILE).'/lang/eng.php')) {
      require_once(dirname(FILE).'/lang/eng.php');
      $pdf->setLanguageArray($l);
      }

      // ---------------------------------------------------------

      // set font
      $pdf->SetFont('times', 'BI', 12);

      // add a page
      $pdf->AddPage();

      // set some text to print

      // print a block of text using Write()
      $pdf->writeHTML($GLOBALS['table'], true, false, true, false, '');

      // ---------------------------------------------------------

      //Close and output PDF document
      $pdf->Output('example_003.pdf', 'D');

      however, when i click the submit button all i get is a blank page no pdf
      download. please any input is appreciated.


      no pdf outputhttps://sourceforge.net/p/tcpdf/discussion/435311/thread/8a92a6e4/?limit=25#8bc8

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/tcpdf/discussion/435311/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
  • Simon

    Simon - 2014-03-05

    Start by turning on all php error messages.

    I suspect you'll get an error that will show where your problem is.

     

Log in to post a comment.