What tools can I use for professional document-creation and -printing in PHP? [closed]

I’m in the process of building a new pledge management system for one of my clients, a charity foundation. I have already built one for them (it was done using Delphi), but its feature-set is a little limited.

Now, I have decided to move to PHP and use the Laravel framework to manage the database for the new system – its Eloquent ORM allows me to easily implement new features that are needed at present. This is good and well – I know everything that I need to do there. However, I am not sure which direction to take for when it comes to creating, saving, and printing documents that will be hand-delivered to donors.

At the moment, it used Word to process documents – i.e. creating invoices, letters of appreciation, and any other templates that may be selected during a pledge submission. The thing is, I am not extremely happy with the implementation, and don’t believe this is the best route to take. There have been times where the documents did not print correctly, or multiple documents where printed (where only one was needed).

Nonetheless, I could stick to Word, provided that PHP can handle it properly and show me progress as it goes along (i.e. Opening Word -> Opening Invoice Template (companies) -> Replacing Variables -> Saving -> Printing -> Closing -> Opening Food Project Mission Statement -> Replacing Variables – > Saving -> Printing -> Closing … etc.). I guess that progress notifications are not necessary, but I would like to have them there – just in case it freezes, the user would be able to see whatever it may be struggling with.

I would assume that I could do this using a jQuery script (with AJAX) that interfaces with a PHP script, but I honestly have no idea how to do it. (Note: I’d have to use AJAX as Laravel uses buffered output.)

I also know that I could pass the information about a pledge to an EXE which would handle the printing on its own, but I don’t think I want to use this implementation as I have plans to make the system cross-platform.

Question 1: Is there a package for PHP that allows me to create documents, save them, and then print them? If not, is there a suitable package that handles Word without difficulty, and with a large array of features?

If it is the latter, I would need to be able to access the full COM API so that I can prevent dialogs from popping up in the background and pausing the procedure.

Question 2: Is there a package (jQuery, AJAX) available that would allow me to track the progress of the document-creation procedure?

EDIT

Having reconsidered everything, and weighed the pro’s and con’s, I would like to put emphasis on printing here. When the user submits a pledge to the database, I need the document to print immediately. I do not necessarily want to focus on a document creation tool only. The reason I asked my question as I did is because I would, ideally, like to find something that can do both the creation and printing of each document. In addition, I do not want to make it too difficult for myself. This is why I originally chose Word – and, it was a lot easier to manage from a Delphi application.

Because of this, I will be leaving the question open (just in case something very interesting is proposed), but will be asking a new question that is a little more specific to the problem that this question originated from.

(To those who have answered so far, thank you for your help and showing me the various options.)

I dont believe PHP alone is well-suited for that task and would suggest looking at LaTex, as long as you can work with PDFs, instead of Word-files.

Latex is primarily used for scientific essay typesetting, but it can do anything related to typesetting and text layout. In science, it commonly replaces word. The .tex-documents are text files that are mostly written by hand, but as its a text file, using php is straightforward.

In your case, the workflow is the following:

  1. Use PHP to load the data you want to print

  2. Have a PHP script to generate a .tex-file

  3. compile the latex file to a pdf.’

2

There are a number of choices available to you here.

If Word output is a hard requirement, look into docx – it’s basically zipped up XML, so generating it in PHP should be fairly straightforward – collect your data, throw it in an XML format, and convert it to Word XML with XSLT, then zip it up.

If PDF is acceptable, LaTeX is your tool of choice – it produces beautiful output, and its automated typesetting is much, much better than anything Word can ever hope for. Generating TeX source directly from PHP can be a bit daunting, especially if you are not familiar with it, but you can go through an intermediate format. DocBook is one option; there is an excellent docbook-to-latex converter called dblatex. Another option is Pandoc, a tool that can convert from a dozen markup languages (including HTML, markdown, ReStructured Text and Textile) into two dozen or so output formats, including LaTeX. Incidentally, Pandoc can also output .odt and .docx directly, so that might also be an option.

Finally, there are some PDF libraries for PHP that would allow you to output PDF directly, but they are either limited in functionality, or proprietary and expensive, or both. Almost all of them require you to do your own text flowing, and you absolutely don’t want that, because, frankly, it is really really hard to get right.

2

LaTex will do it, but you could try ASCIIdoc or ReStructuredText instead, both are lightweight formatting systems. Using docUtils, most will produce output in different formats, including .odt which is as good as .doc and can be loaded in Word or LibreOffice if that matters to you more than pdf.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật