Can i use a "template.html" with TCPDF - php

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

Related

Autofill Scanned PDF from PHP Form

I have a scanned pdf. The top of the pdf is a signed form and the bottom is a section that people can sign to subscribe to the contract. I have a form that can autopopulate the bottom portion although, since it is a scanned pdf, it has no form fields. Does anyone have a solution where using PHP a person can fill out the form and then autopopulate the bottom of the pdf with the data or create a layer over it with the data and merge it into one pdf. Another option possibly is to automatically add the top portion as an image with the form below it. Thank you in advance for your help.
Here is a link to a sample pdf.
You can use FPDI to write text into a template PDF file. See this example.

How to implement an editable textarea component on a PDF generated by TCPDF library?

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.

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!

How can i generate PDF with live editing (Instant edit) and PHP/Ajax

i will programming a tool that can generating a PDF.
i´ve generated PDF´s with FPDF with static data´s in the past.
And now i will that the pdf will be generated by live editing.
e.g: the user can look the finaly pdf page and click on the law fields to type the text.
has anyone ideas?
Thanks !
It is not possible to directly edit PDF file in your browser. All you can do is just get input from user and generate PDF file based on it using fpdf(better use tfpdf for utf support) on your server.
How about you use a tool like TinyMce to edit your data ,grab the output html and create a PDF out of it using MPDF or html2pdf

PHP page to PDF with object oriented websites

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

Categories