1

I'm trying to import a PDF from storage to print values using FPDF and FPDI to download the PDF with the values. My function works perfectly on my local system but fails to open on my staging environment hosted on AWS Lambda. If anyone could assist, it would help me so much. It's so important that I get this done. Even if you could point me in the right direction, I would greatly appreciate it.

Controller

use setasign\FpdiProtection\FpdiProtection;
use setasign\Fpdi\Fpdi;

public function medical_pdf()
{
    // initiate FPDI
    $pdf = new FpdiProtection();
    
    // set title
    $title = "Outsurance Medical Questionnaire";
    $pdf->SetTitle($title);
    
    // add a page
    $pdf->AddPage();
    
    // set password
    $pdf->SetProtection(array(), 'BlueinDecember@2021');
    
    // set the source file
    $pdf->setSourceFile(public_path('/PDF/Generic OutSurance SMR .pdf'));
    
    // import page 1
    $tplIdx = $pdf->importPage(1);
    
    // use the imported page and place it at point 10,10 with a width of 100 mm
    $pdf->useTemplate($tplIdx, -0, -0, 200);
    
    $pdf->Output('D',$title.'.pdf',);
}
Karl Hill
  • 12,937
  • 5
  • 58
  • 95
  • Welome to SO. In a similar situation, it was differing allowed name conventions (e.g. no spaces) and also different folder locations - one required an absolute filesystem path and the other relative to the vapor project. HTH. – Nick Aug 19 '21 at 07:49

0 Answers0