C
C
ChiPer2012-06-25 08:05:29
PHP
ChiPer, 2012-06-25 08:05:29

What template format should I choose to use php variables in it?

There is a following task.
I have an html form that the user fills out. Next, this form is sent to the php handler. The handler must take a ready-made template (with strict GOST design) and insert values ​​into it from the variables passed by the form. Further, this template should be saved and issued to the client for download. What is the best template format to use? pdf, docx, rtf… or? And what are the best tools to use for this task?
PS. It is not necessary to offer to make up a form from scratch in html or or in pdf (and using libraries for PHP). The form is quite large and complex. There are originals of the form in word and in pdf.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
M
Mikhail Osher, 2012-06-25
@ChiPer

www.phpdocx.com/
Very cool stuff. Helped many times.

D
Denis Turenko, 2012-06-25
@Dennion

The simplest of course is RTF. Try to create a file in Word, write Habr, write it in RTF format, open it with notepad and search for this word in the text - everything will immediately become clear how to proceed. For beauty, you can then simply rename the rtf file extension to doc.

S
Sergey Ozeransky, 2012-06-25
@KREGI

I would choose PDF - habrahabr.ru/post/31438/
But I would also give the user the opportunity to download to doc - I didn’t encounter creation, but Doc is xml and styles ... that is, we create a doc file, open it for writing and write xml markup with styles there and text...

C
ChiPer, 2012-06-25
@ChiPer

So far found this solution: www.setasign.de/products/pdf-php-solutions/fpdi/ A special PHP class that allows you to edit PDF templates.

V
Vumik, 2012-06-25
@Vumik

PDF is better, since cross-platform and the view will be the same everywhere (since everything is so serious, according to GOST)
And you can use PHPExcel
to generate PDF If the originals are in Excel, then you can use them as a template into which PHPExcel will substitute the necessary data and keep.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question