Hello,
i'd like to ask for some help on an issue that i think is easily solvable, but I still can't sort out how.
I prepared the scripts for an a4 sized menu booklet. The client also wants a a3 printable version of the same which is not an extended variant of the a4, but it's simply two a4 pages next to each other on an a3 page.
Is it possible to set a page break horizontally?
A4 | A4
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Interesting. Therefore with tcpdf it's not possible to have a "virtual" page break at a given point, right? I'd rather not rewrite everything to fit the a4s inside columns since they'll have to be identical to the original a4 format.
I thought there would be a parameter i could add to $pdf->AddPage.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It is very difficult to say without seeing your code, it may not require much to use columns, or restart on the same page but with different margins - but it may be easier to just use FPDI.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
At least in Adobe Reader you can combine multiple pages to print on one sheet: Pages per sheet "Custom" - "2 x 1" and page order "Horizontal" should do the trick. As I have no A3 printer I can't verify this however.
So if this is just about printing and your client doesn't insist on having the document itself like that, this would be the easiest solution.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ok. im trying to use the concatenation with fpdi.
Like this im getting A3 pages with a A4 on the left side and the right side is blank.
A4 | Blank
A4 | Blank
A4 | Blank
A4 | Blank
how can I have the even numbered pdfs on the right side? This is my code.
// define some files to concatenate
$files = array(
"1_pdfsam_example_048.pdf", "2_pdfsam_example_048.pdf", "3_pdfsam_example_048.pdf", "4_pdfsam_example_048.pdf"
);
// initiate FPDI
$pdf = new FPDI();
// iterate through the files
foreach ($files AS $file) {
// get the page count
$pageCount = $pdf->setSourceFile($file);
// iterate through all pages
for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
// import a page
$templateId = $pdf->importPage($pageNo);
// get the size of the imported page
$size = $pdf->getTemplateSize($templateId);
ok. got it the counter should take in the half pages and not the actual a3 page counts.
This works:
$halfpage = 1;
// iterate through the files
foreach ($files AS $file) {
// get the page count
$pageCount = $pdf->setSourceFile($file);
// iterate through all pages
for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
// import a page
Hello,
i'd like to ask for some help on an issue that i think is easily solvable, but I still can't sort out how.
I prepared the scripts for an a4 sized menu booklet. The client also wants a a3 printable version of the same which is not an extended variant of the a4, but it's simply two a4 pages next to each other on an a3 page.
Is it possible to set a page break horizontally?
A4 | A4
You could either use columns to split over the pages, or create an A4 pdf, then import the pages into an A3 pdf using FPDI.
Interesting. Therefore with tcpdf it's not possible to have a "virtual" page break at a given point, right? I'd rather not rewrite everything to fit the a4s inside columns since they'll have to be identical to the original a4 format.
I thought there would be a parameter i could add to $pdf->AddPage.
It is very difficult to say without seeing your code, it may not require much to use columns, or restart on the same page but with different margins - but it may be easier to just use FPDI.
At least in Adobe Reader you can combine multiple pages to print on one sheet: Pages per sheet "Custom" - "2 x 1" and page order "Horizontal" should do the trick. As I have no A3 printer I can't verify this however.
So if this is just about printing and your client doesn't insist on having the document itself like that, this would be the easiest solution.
ok. im trying to use the concatenation with fpdi.
Like this im getting A3 pages with a A4 on the left side and the right side is blank.
A4 | Blank
A4 | Blank
A4 | Blank
A4 | Blank
how can I have the even numbered pdfs on the right side? This is my code.
// define some files to concatenate
$files = array(
"1_pdfsam_example_048.pdf", "2_pdfsam_example_048.pdf", "3_pdfsam_example_048.pdf", "4_pdfsam_example_048.pdf"
);
// initiate FPDI
$pdf = new FPDI();
// iterate through the files
foreach ($files AS $file) {
// get the page count
$pageCount = $pdf->setSourceFile($file);
// iterate through all pages
for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
// import a page
$templateId = $pdf->importPage($pageNo);
// get the size of the imported page
$size = $pdf->getTemplateSize($templateId);
}
// Output the new PDF
$pdf->Output();
Last edit: floyd0987 2014-12-11
You'll need to specify where to import the page, so something like this:
Thanx Simon, but still with this code I get this:
A4 | Blank
A4 | Blank
A4 | Blank
A4 | Blank
it seems it never gets inside the else statement
else {
//even page
$pdf->useTemplate($templateId, 210, 0);
are your pdfs actually multipage? or are they a series of single page pdfs?
ok. got it the counter should take in the half pages and not the actual a3 page counts.
This works:
$halfpage = 1;
// iterate through the files
foreach ($files AS $file) {
// get the page count
$pageCount = $pdf->setSourceFile($file);
// iterate through all pages
for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
// import a page
}
}