Normally it will be enough to put a link to the PDF , inside the HTML code, as if you were linking any other resource If the PDF is in the location to which the link points, it will open or download automatically.
How you handle the loading of PDFs, their creation, etc. is independent of how you will arrange your download. Unless you are generating them at the moment.
Edited.
This answer is to the specific problem:
Error downloading pdf with php
I'm trying to make the
user download a pdf file with php, the problem is that when
download the files I get the following error:
that is, I indicate the necessary HTML code to be able to download a PDF file , how it is loaded, generated, etc. are other issues that may require the rethinking of this post in whose current content is they mix several concepts.
For a PDF to be downloadable , only an HTML link is required that links the resource and places it in the public folder of a website (I have linked it with an absolute path):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Descarga PDF</title>
</head>
<body>
<a target="_blank" href="http://www.cambialibros.es/public/test.pdf">pdf ejemplo</a>
</body>
</html>
If you create an HTML file with the above code and open it in your browser, when you click, the PDF file will be opened or downloaded.