tcpdi_parser icon indicating copy to clipboard operation
tcpdi_parser copied to clipboard

Blank page when writing on a v.1.5 PDF file

Open nettunodev opened this issue 8 years ago • 0 comments

Hi,

I'm trying to write on a PDF file v.1.5, but it doesn't work. The original file has 7 pages, the new one has only one blank page except for a black line on the top. For privacy reason I can't attach the file.

I'm using a try - catch block to catch exceptions but I don't get any error... Here is my code: ` require('../../../lib/tcpdf/tcpdf.php'); require('../../../lib/tcpdf/tcpdi.php'); try{ $pdf = new TCPDI(); $pageCount = $pdf->setSourceData($content);

$pdf->SetDrawColor(255,0,0);
$pdf->SetTextColor(255,0,0);
$pdf->SetPrintFooter(false);

$pdf->SetFont('helvetica','',8);

for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
	$tplIdx = $pdf->importPage($pageNo);

	$size = $pdf->getTemplateSize($tplIdx);
	$w = $size[w];
	$h = $size[h];
					
	if ($h > $w ){ // Il PDF è Portrait 
		$pdf->AddPage("P");
	}else{	// Il PDF è Landscape
		$pdf->AddPage("L");
	}
					
	$pdf->useTemplate($tplIdx);							
	$pdf->SetXY(0.2,5,true);
	$larghezzaFoglio = $pdf->getPageWidth();
	$pdf->Cell($larghezzaFoglio-0.4, 5, "  ".$stringaTimbro, 1,1,'L');
}
$pdf->Output($name, "D");

} catch (Exception $e) { echo($e); } `

I'm using FPDF_TPL - Version 1.2.3, TCPDF Version 6.2.12, TCPDF parser Version 1.0.16, TCPDI parser Version 1.1, TCPDI - Version 1.0. Please let me know if you need more informations.

nettunodev avatar Feb 21 '17 11:02 nettunodev