i have successfully generated pdf using tcpdf now i want to make that one page to 4 page in one sheet
there is no problem with the script...i just want to make it auto set persheet 4 so the user dont have to configure the setting each time they want to print..is there a way to do this so that i dont have to change my coding to much
as suggested, i use fpdi
$pdf->Output($st.'/TEST.PDF', 'F');
require_once(APPPATH.'libraries/FPDI/fpdf_tpl.php');
require_once(APPPATH.'libraries/FPDI/fpdi.php');
$filename = $st.'/TEST.PDF';
$pdfx = new FPDI();
//exit();
$pageCount = $pdfx->setSourceFile($filename);
//echo $pageCount;
//exit();
$w = $pdfx->GetPageWidth() / 2 - 15;
$h = 0;
$_x = $x = 10;
$_y = $y = 10;
$pdfx->AddPage();
for ($n = 1; $n <= $pageCount; $n++) {
$tplIdx = $pdfx->importPage($n);
$size = $pdfx->useTemplate($tplIdx, $x, $y, $w);
$pdfx->Rect($x, $y, $size['w'], $size['h']);
$h = max($h, $size['h']);
if ($n % 2 == 0) {
$y += $h + 10;
$x = $_x;
$h = 0;
} else {
$x += $w + 10;
}
if ($n % 4 == 0 && $n != $pageCount) {
$pdfx->AddPage();
$x = $_x;
$y = $_y;
}
}
$pdfx->Output('thumbnails.pdf', 'F');
but im getting a error message
A PHP Error was encountered
Severity: Warning
Message: fopen(): remote host file access not supported, file://thumbnails.pdf
Filename: include/tcpdf_static.php
Line Number: 2466 A PHP Error was encountered
Severity: Warning
Message: fopen(file://thumbnails.pdf): failed to open stream: no suitable wrapper could be found
Filename: include/tcpdf_static.php
Line Number: 2466 TCPDF ERROR: Unable to create output file: thumbnails.pdf
is this a conflict libraries in codeignighter? i load tcpdf then i require once fpdi libraries
oh i think i know the problem is about the saving location... nevermind i re-edit my Output to $pdfx->Output('thumbnails.pdf', 'I');