So, i need to display Flexible content in TCPDF, i have my Flexible content fields:
if( have_rows('levels') ):
while ( have_rows('levels') ) : the_row();
if( get_row_layout() == 'level_one' ):
$sub = the_sub_field( 'subtitle_' );
$pic = the_sub_field( 'image');
endif; endwhile;
else :
endif;
then when i try display this all in my TCPDF function, i have problem, my TCPDF function:
function getSiteContent($post_id, $fileName, $ls){
require_once(dirname(dirname(__FILE__)).'/inc/TCPDF/examples/tcpdf_include.php');
//$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf = new TCPDF('P', PDF_UNIT, 'A4', true, 'UTF-8', true);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(get_bloginfo('admin_email'));
$pdf->SetTitle('Site Content');
$pdf->SetSubject('Site Content');
$pdf->SetKeywords(get_bloginfo('name'));
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(20, 20, 20);
$pdf->setCellHeightRatio(1.5);
$pdf->SetAutoPageBreak(true, 5);
if(@file_exists(dirname(dirname(__FILE__)).'/inc/TCPDF/examples/lang/rus.php')) {
require_once(dirname(dirname(__FILE__)).'/inc/TCPDF/examples/lang/rus.php');
$pdf->setLanguageArray($l);
}
$pdf->SetFont('pfdindisplaypro', '', 12);
$pdf->AddPage();
//===background IMG===
$pdf->Image($img_file, 0, 0, 3508, 2480, '', '', '', false, 150, '', false, false, 0);
$pdf->SetAlpha(1);
$pdf->setPageMark();
$tagvs = array('h1' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)),
'p' => array(0 => array('h' => 0, 'n' => 0), 1 => array('h' => 0, 'n' => 0)));
$pdf->setHtmlVSpace($tagvs);
$html='
<div style="text-align:center; font-size:13px;">
<h1 style="font-size:15px; letter-spacing:1px"><b>'.get_the_title($post_id).' </b></h1>;
<h2 class="main__subtitle">'.$sub.'</h2>
<img src ="'.$pic.'" />
<br>
</div>';
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->lastPage();
$pdf->Output($fileName, $ls);
}
nothing is displayed in PDF variables, where i'm wrong?