0
votes

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
1
What are the paths to this source file and PDF.pdf ?mbesson
path to source file is example.com/app/control/ and the same for pdf. FPDI works fine until it goes onto the server.user2213713

1 Answers

0
votes

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.