Not able to marge 2 pdf dynamically using PDFmarger in php


I am getting error "This webpage is not available" while merging multiple PDF which generated dynamically using PDF marger.

Here is my code :


    $pdf = new PDFMerger;

    $pdf->addPDF('\PDFEBS.pdf', 'all');
    $pdf->addPDF('\PDFHI.pdf', 'all');

    //echo $basepath.$post['fileName'];
    return true;



Try adding the path before your PDF file includes like so:

$pdf->addPDF(realpath($_SERVER['DOCUMENT_ROOT']).'\PDFEBS.pdf', 'all');
$pdf->addPDF(realpath($_SERVER['DOCUMENT_ROOT']).'\PDFHI.pdf', 'all');

Assuming your realpath returns the right path of course.

And try reversing your slashes. \ => /

People are also looking for solutions to the problem: php - preg_match_all on the same line


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.