title: How to generate pdf from php functions & variables in TCPDF
body: <p>i have functions which takes stylesheet &amp; gets output from other classes using OOP in PHP.
  i need to generate the pdf using TCPDFm but i am facing problem how to pass in $html variable, i have read the manual for XHTML+ CSS using that does not explain the PHP variable output.
  I am pating my code here, please help.</p>
  
  <pre><code>&lt;?php
  // define some HTML content with style
  $html = &lt;&lt;&lt;EOF
  &lt;?php $frame-&gt;HTML_DOCTYPE(); ?&gt;
  
  &lt;html&gt;
      &lt;head&gt;&lt;?php $frame-&gt;HTML_Title($page); $frame-&gt;HTML_CSS($page); $frame-&gt;HTML_JS($page); ?&gt;&lt;/head&gt;
          &lt;body&gt;
              &lt;div class='container_pngfix'&gt;
                  &lt;?php echo $frame-&gt;Print_Top($page); ?&gt;
  
                  &lt;div class='container_magazine'&gt;
                      &lt;div class='magazine_left'&gt;
                          &lt;?php 
                          /*if(FALSE == empty($_SESSION['wi_id']) &amp;&amp; FALSE == empty($_SESSION['wi_type']) &amp;&amp;  0 == strcasecmp('bride',$_SESSION['wi_type'])){*/
  
                    if ($_REQUEST['magazineId']!="") {
                      echo $article-&gt;Print_Magazine_Issue($_REQUEST['magazineId']);
                    } else if ($_REQUEST['latestissue']) {
                      echo $article-&gt;Print_Magazine_Issue($article-&gt;getLatestMagazineId());
                    } else {
                      if (isset($_REQUEST['magazinedate'])) { $magazinedate=$_REQUEST['magazinedate']; } else { $magazinedate=""; }
                                  if ($magazinedate=="") { $magazinedate=date("Y-m")."-01"; }
  
                      echo $article-&gt;Print_Magazine($magazinedate);
                    }
                          /*}else{
                              echo "&lt;h2&gt;Please Login/Register first to see Magazine details&lt;/h2&gt;";
                          }*/
                  ?&gt;              
                  &lt;/div&gt;
                      &lt;div class='magazine_right'&gt;&lt;?php echo $frame-&gt;Print_RightSide_Articles($page); ?&gt;&lt;/div&gt;
                      &lt;div class='clearfloat'&gt;&amp;nbsp;&lt;/div&gt;
                      &lt;?php echo $frame-&gt;get_ContextualWeb($page,"low"); ?&gt;
                  &lt;/div&gt;
  
              &lt;/div&gt;
              &lt;?php echo $frame-&gt;Print_Bottom_Links($page); ?&gt;
              &lt;?php $frame-&gt;Print_Bottom($page); ?&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;EOF;
  
  $pdf-&gt;writeHTML($html, true, false, true, false, '');
  $pdf-&gt;lastPage();
  
  // ---------------------------------------------------------
  
  //Close and output PDF document
  $pdf-&gt;Output('example_061.pdf', 'I');
  ?&gt;
  </code></pre>
  
  <p>In this code i am calling multiple functions using objects of those classes.
  All html &amp; content of page is generating dynamically. i have problem of passing the PAGE html &amp; PHP code in $html variable.</p>