I am new to codeigniter, and not so new to PHP.开发者_开发问答 I am developing a site that has a login for 2 users and once they login, it'll show an optin to view an invoice. I am not making the invoice since I have a stack of invoices already. I want to do it so that once they click on view invoice they can see a PDF. I have searched but I ask you for some idea in the visualization of PDF in codeigniter?
I'm guessing that you want to generate pdfs. There is a library called dompdf that lets you do it quite easily and there is documentation on using that with Codeigniter.
If you're wondering how to link between a pdf and a customer, I'd suggest adding a field in the database to match each customer or perhaps a whole table depending on your use case.
Not sure if I understand your question but here goes...
If you just want to marshal an existing PDF file via PHP, its basically a case of
- Send the appropriate "Content-Type" response headers for a PDF file, eg
application/pdf
- Deliver the file contents using something like readfile()
From my understanding, you have a directory of PDFs that need to be displayed to the user.
This is usually handled by the PDF software. Adobe Reader can render the PDF in the browser and so can newer releases of the Chromium which have PDF viewing built in.
Make sure you send the correct response headers as Phil Brown points out and you're all set.
精彩评论