PHP page to PDF with object oriented websites - php

I'm trying to get my shopping cart items to a pdf to create an invoice
I have url which shows the invoice in html/css like this:
index.php?module=checkout&view=topdf
If I want to get the content of that page to use in mPDF or other pdf libraries using file_get_contents or cURL it doesn't give any content because the url is not an actual file on the server
How can I fix this? I work with templates and don't know how can I export the current php page to a html page

I used TCPDF for something similar. Getting the formatting right is a bit of a pain but once you've got that it's a really good bit of work.
http://www.tcpdf.org/examples.php

Related

Can i use a "template.html" with TCPDF

I have found an example online using DomPDF and a template.html file on an invoice that is verry handy.
is there a way to do the same with TCPDF?
I have a form that generates a table with dynamic content and then by pressing a button if prints it on to a pdf but in a rudementery style.
By using a template thing would come out nicer.
Can it be done ?
thank you all

Wordpress article and dynamic data/graphs, images to PDF

I'm using Wordpress to manage a newsletter with IssueM, also I need to be able to export the content of a group of articles to PDF (Keep in mind that I'm not a php hardcore developer).I'm using Advanced Custom Fields to generate some data and then creating graphs using NVD3 with javascript.
At this time, all the plugins I found to create PDF's did not work, they only "print" the title of the post(article in IssueM) and nothing else.
I need to be able to export the content, rendered graphs and tables with images, to PDF as they appear in the browser (styled via CSS in my page).
I found there is FPDF, and mPDF, also DOMPDF but they don't specify if they can render the javascript output (which are my NVD3 rendered graphs) to PDF.
Is there any tool that can acomplish this? or,
Do I have to do this by hand? If that's the case, can you tell me an approach?
Have you had a look at:
https://wordpress.org/plugins/printfriendly/
You should be able to add/remove/customize elements that print out:
http://support.printfriendly.com/publisher/developer-questions/include-exclude-content/
It should render javascript because it is using javascript (make sure you enable javascript use in the plugin):
http://support.printfriendly.com/publisher/wordpress/javascript-option/
Hope that helps!

PHP AJAX PDF Reader just like book

Does anyone know how to build something like the functionality shown here: like sliding a book
I want to load PDF content, so that users can read all of my PDFs like a slideshow.
I'd like to use PHP, MySQL and JQuery, but I haven't found any JQuery plugin that functions like a PDF reader.
Don't think there is a solution in AJAX, jQuery or Javascript yet. You have to build it yourself or...
what you can do is convert each page in PHP to JPG (there are a lot of classes to do that), after that you can then load the pages in a jQuery Slideshow or load the images external from a flash file.

How to save a page as pdf in php

Does anyone know how I can save a page as pdf in php?
Example:
I have a page that is able to catch the users signature. Now I would like to create a button on the page that will convert the page into pdf so that the file can be saved to a folder.
Below you can see what the signature page looks like:
There are a number of PHP PDF API and tools which convert or wrap up html content including drawings, links and images etc.
A very good thread from StackOverflow :
Convert HTML to PDF using PHP
TCPDF can output PDF's from html: http://www.tcpdf.org/
If you need to use more advanced html you can use WKHTMLTOPDF: http://wkhtmltopdf.org/

how to display PDF in a php site?

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.

Categories