FPDF mssql数组,单元格分页错误中的图像
FPDF mssql array, image in cell pagebreak error
我正在尝试使用 fpdf 每页显示 4 张图像。我正在使用单元格和 GetX 和 GetY 来订购,这对我来说很有效,但是当创建一个新页面时,第一个单元格总是空的,它发生在所有页面中,只是在第一页上显示良好。请帮我!
这是我的代码:
class PDF extends FPDF {
}
$pdf = new PDF('P','mm','Letter');
$pdf->SetFont('Times','',12);
$pdf->AddPage();
$con = mssql_connect(DB_HOST3, DB_USER3, DB_PASS3, DB_NAME3);
mssql_select_db("SBO_Amarillo", $con);
$result = mssql_query(" select ValeNo from dbo._SBOF_WebPage_ValesPorFactura ( CONVERT(VARCHAR,'$a')) order by ValeNo");
while($rows = mssql_fetch_array($result))
{
$documento = $rows['ValeNo'];
$x = '.gif';
$pdf->Cell( 160, 60, $pdf->Image(LAGGER.$documento.$x, $pdf->GetX(), $pdf->GetY(), 160,60), 1, 2, 'C', false );
$pdf->ln(5);
}
$pdf->Output('Boletas.pdf','I');
已解决!我用这个:
$pdf = new PDF('P','mm','Letter');
$pdf->SetFont('Times','',10);
$pdf->AliasNbPages();
$pdf->SetMargins(15,15,10);
$image_height = 150;
$image_width = 58;
$pdf->AddPage();
$con = mssql_connect(DB_HOST3, DB_USER3, DB_PASS3, DB_NAME3);
mssql_select_db("SBO_Amarillo", $con);
$result = mssql_query(" select ValeNo,Nombre from dbo._SBOF_WebPage_ValesPorFactura ( CONVERT(VARCHAR,'$a')) order by ValeNo");
while($rows = mssql_fetch_array($result))
{
$documento = $rows['ValeNo'];
$name = $rows['Nombre'];
$x = '.gif';
$rr = ' ';
$start_x = $pdf->GetX();
$start_y = $pdf->GetY();
$pdf->Cell(10,10,$name.$rr.$documento,0,1,'L');
$pdf->Image(LAGGER.$documento.$x, $pdf->GetX(), $pdf->GetY() ,$image_height, $image_width) ;
$pdf->SetXY( $start_x , $start_y + $image_width + 10);
if ($start_y >= 150)
{
$pdf->AddPage();
}
}
$pdf->Output('Boletas.pdf','I');
谢谢!
我正在尝试使用 fpdf 每页显示 4 张图像。我正在使用单元格和 GetX 和 GetY 来订购,这对我来说很有效,但是当创建一个新页面时,第一个单元格总是空的,它发生在所有页面中,只是在第一页上显示良好。请帮我! 这是我的代码:
class PDF extends FPDF {
}
$pdf = new PDF('P','mm','Letter');
$pdf->SetFont('Times','',12);
$pdf->AddPage();
$con = mssql_connect(DB_HOST3, DB_USER3, DB_PASS3, DB_NAME3);
mssql_select_db("SBO_Amarillo", $con);
$result = mssql_query(" select ValeNo from dbo._SBOF_WebPage_ValesPorFactura ( CONVERT(VARCHAR,'$a')) order by ValeNo");
while($rows = mssql_fetch_array($result))
{
$documento = $rows['ValeNo'];
$x = '.gif';
$pdf->Cell( 160, 60, $pdf->Image(LAGGER.$documento.$x, $pdf->GetX(), $pdf->GetY(), 160,60), 1, 2, 'C', false );
$pdf->ln(5);
}
$pdf->Output('Boletas.pdf','I');
已解决!我用这个:
$pdf = new PDF('P','mm','Letter');
$pdf->SetFont('Times','',10);
$pdf->AliasNbPages();
$pdf->SetMargins(15,15,10);
$image_height = 150;
$image_width = 58;
$pdf->AddPage();
$con = mssql_connect(DB_HOST3, DB_USER3, DB_PASS3, DB_NAME3);
mssql_select_db("SBO_Amarillo", $con);
$result = mssql_query(" select ValeNo,Nombre from dbo._SBOF_WebPage_ValesPorFactura ( CONVERT(VARCHAR,'$a')) order by ValeNo");
while($rows = mssql_fetch_array($result))
{
$documento = $rows['ValeNo'];
$name = $rows['Nombre'];
$x = '.gif';
$rr = ' ';
$start_x = $pdf->GetX();
$start_y = $pdf->GetY();
$pdf->Cell(10,10,$name.$rr.$documento,0,1,'L');
$pdf->Image(LAGGER.$documento.$x, $pdf->GetX(), $pdf->GetY() ,$image_height, $image_width) ;
$pdf->SetXY( $start_x , $start_y + $image_width + 10);
if ($start_y >= 150)
{
$pdf->AddPage();
}
}
$pdf->Output('Boletas.pdf','I');
谢谢!