Reputation: 1
I am using Codeignighter, FPDF and FPDI to Amend a PDF to be emailed to a client.
Using the basic example give by FPDI I can get my code to work perfectly on localhost (standalone php file, no codeignighter) however when i put the same file onto my server i get the following warning and error.
Severity: Warning
Message: fopen(PDF.pdf): failed to open stream: No such file or directory
Filename: PdfParser/StreamReader.php
My code:
require ('fpdf182/fpdf.php') ;
require ('setasign/Fpdi/autoload.php') ;
use setasign\Fpdi\Fpdi;
$pdf = new Fpdi();
$pdf->AddPage();
$pdf->setSourceFile('PDF.pdf');
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx, 10, 10, 100);
$pdf->SetFont('Helvetica');
$pdf->SetTextColor(255, 0, 0);
$pdf->SetXY(30, 30);
$pdf->Write(0, 'This is just a simple text');
$pdf->Output('I', 'generated.pdf');```
Thank you for your time and thank you in advance
Upvotes: 0
Views: 2174
Reputation: 180
Did you check the permission of the folder that is supposed to save the pdf file? Your webserver runs as some user and this user should have write permissions.
Upvotes: 0