Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank page when writing on a v.1.5 PDF file #18

Open
nettunodev opened this issue Feb 21, 2017 · 0 comments
Open

Blank page when writing on a v.1.5 PDF file #18

nettunodev opened this issue Feb 21, 2017 · 0 comments

Comments

@nettunodev
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant