Printing an html page with TCPDF in laravel 4 - php

So I have an html document which I am writing inside a long string called $content. I am supposed to pass this string to a pdf builder object to print it as a pdf file.
Only problem is the pdf file has a line at the bottom that interferes with my cotent when it reaches the bottom of the page like this table
As you can see the pdf footer line crosses my table and I don't want this to happen. I want to somehow predict if this line is going to cross and then print the whole crossed content in another pdf page.

Related

Completly remove margin with tcpdf when printing the document

I'm using tcpdf to create a report. I have an image in the header and in the footer. When I generate the pdf (view on the screen), I successfully removed the margins. But, when I print it, is there a way to remove the margin set for the printing?
My customer would like to have a document like if they print on a paper that already have the header/footer.
Is this possible? (first picture is what I see on the screen after generate the pdf, second picture is what I get when I want to print it)
This can't be done via PHP nor TCPDF. You either have to change the printing configurations of the program used to print or the ones of the printer. And the printer has to support printing without margins.

TCPDF Paging with QR Code

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?

TCPDF cuts text when the page end / footer is reached?

I am using TCPDF to create PDFs with PHP. Everything works very nice, except when text would be placed where the footer resides. In my example, the text is shown only half, the rest is behind the footer. Is there an option which defines to put it on the next page?
Besides that, my PDFs differ from print to print, some have 1 page, some 2 or more. Is it possible to say that a specific text should only be placed on the page when it fits completely? if not, it should go to the next page.
I already have this in my code, but it doesnt help, the text is still cut.
$pdf->SetAutoPageBreak(true, 25);
I am creating the PDF by creating a huge HTML string and print that to the PDF using writeHTML. This is how it looks, the bold text on top should go to the next page, its hidden behind the footer.
Thanks!

linking php pages

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.

Filling a PDF template with PHP

I have a PDF file that functions as a template containing only textboxes. Is there any way I can fill the fields in via PHP? I have found examples of how to directly draw onto a PDF document when given x,y values, but I want to put values into my textboxes rather than doing that.
Sourabh's link showed that this is impossible in Android, I'm reverting to using a HTML document with filler where the textboxs in the PDF were and replacing them in code.

Categories