I have a php page that generates a pdf using mpdf (php to pdf).. So when the users goes to this page the pdf is generated.. I have decided that rather then output the pdf to the browser I will email it to them.. That is all fine and works great.. So at the end of the pdf generating code I put the code for the html page to show.. Like a brand new page.. All works perfectly except for in IE.. where the layout is all messed up.. BUT if I put the html code before the pdf generating code it all looks fine.. and if I put the html in its own page it all looks fine.. Something in the pdf generating code is messing with IE..
So question is.. What about if I link the pdf generating page to the html page..
ie have two pages.. one php page with the html code saying what I want displayed.... and then link to the pdf generating code.. like include("pdfpage.php"); Include won't work, but anything else? Function?
Ideas? Stuck.
Thank you
You might try to wrap your PDF generation code up and try to not let it interfere with your HTML page.
A starting point is ob_start(). You can start an output buffer before generating your PDF
. That captures any output your PDF generation code might produce. You can then have a look at it, dispose of it or do whatever you like with it.
That way, no left-overs will be interfering with your HTML page.
Related
I've created a simple html and it looks perfectly
But when I use it as maintenance for my wordpress site it has lesser height that expected. CSS and inner HTML are completely the same, I've just inserted html inside maintenance.php
There are some screens to show what I mean:
The problems seems to be that height is not full screen, but I can't tell the difference
I have to generate a PDF document that could take more than one page. Each page has a html table (that has a variable length), and a QR code at the bottom of the page.
The QR code will be at the bottom of every page of the document, but, if that is too difficult to achieve, I can have it only in first page.
I have the problem that the text of the html table is printing over the QR code. I tried using $pdf->setPageRegions without any positive result, because the coordinates used to define the position of QRCode and for setRegions are in different units.
How can I achieve this?
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
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/
I am working on ckeditor in my php code. I would like to get some external html content displayed on ckeditor so that users can edit the content like they want. Please let me know how can I accomplish this.