[Solved] How to increase the paper size as per my image size using FPDF-php?


I got it by adding my image into a cell like below

require('lib/fpdf.php');
        $image = MEDIA_DIR."uploads/pdf_images/".$report_img.".png";
        list($width, $height, $type, $attr) = getimagesize($image);
        $pdf = new FPDF();
        $pdf->SetSize(($width/2)+110,($height*57/100)); //Custom function
        $pdf->AddPage('','custom');
        $pdf->cell(1000,1000,'',$pdf->Image($image,10,10,235,$height*18/100),'PNG');
        $pdf->Output();

Add the below function to fpdf.php

function SetSize($width,$height)
{
    $this->StdPageSizes['custom']=array($width,$height);
}

solved How to increase the paper size as per my image size using FPDF-php?