Question

I've recently started using FPDF because I need to generate some PDF files for a school project. All the files are properly included, but when I try to run the code to save the file it gives me the following error:

ErrorException [ Warning ]: fopen(pdfs/example1.pdf): failed to open stream: No such file or directory

I have already checked to make sure the permissions of the selected folder are "read & write" (I'm working on a mac). Does anyone know what else could be causing this?

Elaboration: The file does not appear where I want it to be saved, which is why the code also cannot find it, thus returning the error.

Was it helpful?

Solution

What code are you using? This simple example I threw together works perfectly.

<?php
require_once('fpdf17/fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Write(5,"Hello, World!\n\n\n");
$pdf->Output('pdf.pdf', 'F');
?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top