这是我的代码,有人能帮我吗?输出以pdf格式显示,但在现有pdf模板中显示Resource id #14
等值。
The Reason is due this($pdf->Write(73, ".$result);) line it打印资源id#14
如果我把$myrow
,而不是$result
,它在pdf中显示什么都没有,所以该怎么办,请任何人帮助我,我一直保持它的按钮,点击生成pdf,也解决FPDF错误:Some data has already been output, can't send PDF file
和我没有在while循环中放入任何东西来解决上面相同的错误
我的代码从这里开始
<?php
if(isset($_POST['btn_NEXT'])) {
mb_internal_encoding("UTF-8");
header('Content-Type: text/html; charset=utf-8');
ini_set('display_errors', true);
include('/Fpdf(1.7)Extracted/fpdf.php');
include('/Fpdi(1.6)Extracted/fpdi.php');
$con=mysql_connect('localhost','root') or die('Error');
mysql_select_db('DbName');
$pdf =& new FPDI();
// add a page
$pdf->AddPage();
// set the sourcefile
$pdf->setSourceFile('Demo_Marathi2.pdf');
// import page 1
$tplIdx = $pdf->importPage(1);
// use the imported page as the template
$pdf->useTemplate($tplIdx, 0, 0, 0, 0, true);
$cmd = "select * from Demo_hindi";
$result = mysql_query($cmd);
while ($myrow = mysql_fetch_assoc($result)) {
}
//$pdf->Text(105, 73, $myrow['DemoHindi']['demo_Values']);
//$pdf->Text(105, 73,$result);
//$pdf->Write(65,$myrow['DemoHindi']);
//$pdf->Write(73,$myrow['demo_Values']);
$pdf->Write(73, "".$result);
echo"".$pdf->Output('newpdf.pdf', 'D');
//PDF CREATION CODE enchant_dict_suggest(dict, word)
ob_end_clean();
}
我必须强调这是一个猜测,因为我从未见过这些类(FPDF, FPDI)
<?php
if(isset($_POST['btn_NEXT'])) {
mb_internal_encoding("UTF-8");
header('Content-Type: text/html; charset=utf-8');
ini_set('display_errors', true);
include('/Fpdf(1.7)Extracted/fpdf.php');
include('/Fpdi(1.6)Extracted/fpdi.php');
$con=mysql_connect('localhost','root') or die('Error');
mysql_select_db('DbName');
$pdf =& new FPDI();
// add a page
$pdf->AddPage();
// set the sourcefile
$pdf->setSourceFile('Demo_Marathi2.pdf');
// import page 1
$tplIdx = $pdf->importPage(1);
// use the imported page as the template
$pdf->useTemplate($tplIdx, 0, 0, 0, 0, true);
$cmd = "select * from Demo_hindi";
$result = mysql_query($cmd);
while( $myrow = mysql_fetch_assoc($result) ) {
/* This is where you need to fetch the data and write the output */
/* I don't know what the method `Text` does so this is a guess */
$pdf->Write(65, $pdf->Text(105, 73, $myrow['DemoHindi'] ) );
$pdf->Write(73, $pdf->Text(105, 73, $myrow['demo_Values'] ));
}
echo"".$pdf->Output('newpdf.pdf', 'D');
//PDF CREATION CODE enchant_dict_suggest(dict, word)
ob_end_clean();
}
?>