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.
Related
I am trying to create an editable HTML textarea component using TCPDF API library. I want to display a scrollable text box on the screen.
Can this be done?
Current TCPDF examples include these: https://tcpdf.org/examples/
I know PDFs can have editable components, but I am not sure how to create them with TCPDF, if it is at all possible.
TD;DR: how can I generate a page with a scrollable textarea using PHP + TCPDF?
Linked Answer using another library (mPDF):
Note that while How to create editable Pdf form in php may work, it does not make use of TCPDF library. My existing codebase relies heavily on TCPDF, I would like to explore the possibility of using TCPDF before I consider adding another library ...
i.e. I rather have an answer of "Not possible" than to use another library at this time.
It looks like the issue is two-fold.
First, you can use a typical form example, like here: https://tcpdf.org/examples/example_054/
However, you cannot see editable fields in a browser, at least you cannot in Mozilla Firefox 56.0.2 as the time of this writing. (https://support.mozilla.org/en-US/questions/1006115)
What you need to do is open the generated PDF in a different viewer that supports editable form fields, such as Adobe PDF reader/other.
Then you can fill out the textarea and if text size exceeds the area of the form element, it will have scroll bars added to the textarea.
Are we able to change amount in already generated PDF file ? I want to change Total amount only in bellow screenshot, I don't want to regenerate that PDF file ?
Any suggestion welcome.
That's not possible. With FPDI you can "only" import existing pages into a reusable structure. You cannot edit the page content.
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.
I am doing one web application society management system. In this application I want to generate pdf file for each user separately. Means during invoice generation , if there are 10 users then for each user separate invoice should get generated as a pdf after clicking on generate PDF button. My invoice got generated for each user but now I dont understand how to convert it into pdf dynamically. So please help me in this question ?
Use any of the following php scripts to generate dynamic PDF documents
fpdf: http://www.fpdf.org/
tcpdf: http://www.tcpdf.org/
You probably have to check out this lib: mPDF
It's quite easy to use and allows you to generate PDF from HTML templates.
I created a web application in PHP.
The application should print a receipt in a dot matrix printer (Epson LQ300).
The receipt layout is customized and the paper is punched.
Right now I created a pdf with custom paper size, but the user should do 3 click to finally print the receipt, wich has some paper feeds errors.
So I want to let the user click on printer icon of the receipt and the next thing happens is the receipt being printed.
Let's asume that the priter is only one, localy, and default, so I first need to avoid select printer dialog.
How to do that from a PDF reader?
Asuming that I change the approach and use only HTML, and forget about PDF:
How to control the exact position of the fields ?
How how to avoid "Select Prnter Dialog"?