Forum How do I...?

Merging more pdf files

Christian
Hi!!!I try to merge in one file more files, I use FPDF, but I get an error. I try the same function with other pdf files, generated without prince and I get one file. Why? maybe are there some custum options to modify the kind of pdf files with prince? Or is there any good function for merging?

Bye bye

Christian
mikeday
What is the error that you get?
Christian
Hi!!!!....this is the error: FPDF error: Unexpected data in xref table

As you can see I try to use FPDF....when I try to use different PDF it's all ok...
mikeday
I don't quite understand how you are using FPDF. I thought that FPDF is used from PHP to generate PDF files, not to merge multiple PDF files together to make one PDF file. Or are you combining PDF files made from Prince and made from FPDF? Please list the actions that you are doing and exactly where it fails.
Christian
Hi!!I use this function to concatenate pdf files:

function pdf_completo ($fallimento_id){

require ('fpdf/fpdf.php');
define('FPDF_FONTPATH','font/');
require('fpdi/fpdi.php');



class concat_pdf extends fpdi {
var $files = array();
function concat_pdf($orientation='P',$unit='mm',$format='A4') {
parent::fpdi($orientation,$unit,$format);
}
function setFiles($files) {
$this->files = $files;
}
function concat() {
foreach($this->files AS $file) {
$pagecount = $this->setSourceFile($file);
for ($i = 1; $i <pagecount>ImportPage($i);
$this->AddPage();
$this->useTemplate($tplidx);
}
}
}
}

$documenti = array();

while($unione_doc = mysql_fetch_array($unione_doc_info)){
$unione_doc = array_map("stripslashes",$unione_doc);
array_push ($documenti,'tmp_output/' . padding($unione_doc['creditore_id'],5,0)."_".padding($fallimento_id,5,0). '.pdf');
}





$pdf= new concat_pdf();
$pdf->setFiles($documenti);
$pdf->concat();

$pdf->Output('tmp_output/' . padding($fallimento_id, 5, 0) . '.pdf',F );
$pdf->Close();
mikeday
Okay, so you are using FPDI to import pages from PDF files created by Prince, and then using FPDF to stick those pages together into a new PDF file. Are the initial PDF files saved correctly? Can you load them in Acrobat?

Another option for merging PDF files is the pdftk program, which might work better.
Christian
Hi!...yes I try to merge with FPDF. When I generate PDFs with Prince I can visualize them with Acrobat. Now Im' trying your software.

Bye

Christian
Christian
Hi!...yes I try to merge with FPDF. When I generate PDFs with Prince I can visualize them with Acrobat. Now Im' trying your software.

Bye

Christian
anu
I am actually converting html to pdf which is 2 page content.
If want to add more pdf it is overwriting the existing ones and I am not able to merge pdf's. Please help.

Thanks
mikeday
Prince cannot merge multiple PDF files into one, you will need to use a different tool for that.
anu
Thank you. I have another question.. I am using font-family:Helvetica in my html but when i go to pdf properties it shows TimesNewRoman.. Any idea ??

Thanks
mikeday
Prince will fallback to Times New Roman if it cannot find other fonts that you have specified. Perhaps Helvetica is not installed, or installed under a different name.