Completly remove margin with tcpdf when printing the document - php

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.

Related

Hide header tags in WKHTMLPDF TOC

I'm trying to generate a PDF Catalog including a table of contens with wkhtmltopdf.
To achieve this I create a toc dump, and read it's content through PHP. So long - no problem...
Now I have some headers, that have to be display inside the TOC, but not in the rendered PDF. So I set the mentioned headers to "display: none". If I do so, they don't appear in the TOC.
I need a possibility to render some headers into the TOC without displaying them in the PDF document.
This can be achieved using --xsl-style-sheet option and using a customized XSL. You can add any content to it.

Creating a PDF for Thermal Printing using PHP

I want to generate a PDF file which can be printed in a Thermal Label Printer (exactly it is a Zebra GK420d). I'm using the library mPDF.
The problem is the content of the file includes a table with invoice details, the library auto split the table (page break). I tried a way that is set:
page-beak-inside:avoid; in html tag of table
$mpdf->use_kwt = true; in code
But the result is unchanged.
I want to ask how can I generate a file with auto height or a certain number which is set programmatically. Please show me the way or can you suggest me another library ?
Thanks in advance.

Is it possible to show some php content inside an html image?

Is it possible to display some php content within an HTML image (say display on the screen of an iPhone where iPhone being an image)
Well, if you just want to overlay text on an image, why create an image at all.
you can use css background image(iphone in this case) for a div and the insert your phpp content as a child of that div. Using proper css styling and positioning, you will get your desired look. Its simple and less server consuming than going the image creation way.
You could generate your own image on the server using the GD library to overlay your content onto the image and then send that to the client.
You can use CSS to achieve the same effect, without requiring any server processing; however, it must be an image, you might want to check out the image processing library that allows you to manipulate images using PHP http://php.net/manual/en/book.image.php.

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!

Place a label on the image?

I got a page here http://183.78.169.53/tyre2/page2.html. For now is static but I will be reading from the database and form something like this dynamically. The problem as I read position ID from the db and would like to place on each of the tyres? Any idea how to achieve it?
There are a fews ways to put labels on images in web applications.
Make an HTML element like a div or span, whose css background property is an image. You will have
to change the css dynmaically if the image is read from a database.
Generate a new image by compositing the text and background image server-side (but that is sooooo 1990s!)
Generate the whole display using <canvas>
Given what you have already, I would go with option 1.
You can put another image with the number on top of the tires. Alternatively, if all the images are the same, you can set the image as a background for the div/li/aand print the number as plain text.
If every picture is different, you can assign every div (or whatever it is) an I'd, and echo custom CSS that sets a different background image for each div.

Categories