Avatar of Marthaj
Flag for United States of America asked on

Programmatically creating PDFs

I am seeking advice and suggestions concerning creating PDF documents. I researched many sites but thought I would ask you folks about it.
I will be extracting data from MS SQL Server - 2014 database from many tables to create/populate the PDF document which will be on our web server.
Basically, the user will click a button and code will generate the PDF file.
I can find my way around Java but client doesn't not want to use C or Net.
I use localhost - Win 10 - and mainly PHP - v5.6.25 (client version - no plans to upgrade - their web server is Linux) with Wampserver and Apache 2.4.23.
I have looked at Apache PDFBox - got confused about it. I also took a long peek at iText. I did request a quote but they have never responded to me.
The creation of the PDF document must be created programmatically.
Any thoughts - suggestions - advice would be appreciated.
thank you.
PDFJavaPHPMicrosoft SQL Server

Avatar of undefined
Last Comment

8/22/2022 - Mon
Chris Stanyon


Probably the easiest way is to use one of the PHP PDF Libraries. The general idea is that you generate a layout using HTML (populated with your DB data / maybe using HTML Tables etc) and then you export / save that HTML content directly to PDF. This is way easier than manually trying to place items on a PDF canvas using co-ordinates.

A couple spring to mind - DomPDF, TcPdf

Have you looked at the ssrs option if these are reports that are regularly generated?
Agree with Chris, php and Java include libtaries to create PDFs.
Are you pulling data usin jdbc or odbc from php?
Scott Fell

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.

Wow !! Great resources to review and suggestions. I thank all of you folks. I am going to research the suggestions for the next two days and report back then with results. And then close out my question. Once again, thank you folks.
Stay tune for part 2 !!
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy

Thank you all for responding - very helpful. I have settled on using FPDF - which seems to be very good.