?
Solved

Dynamic print solution for PHP

Posted on 2005-03-29
8
Medium Priority
?
249 Views
Last Modified: 2008-03-17
Hope I am posting this in the correct place.  I am wondering the easiest and quickest solution for providing printed output from a php script..  CSS obviously has its problems and I think producing pdfs is likely to be the best choice.

I need control over page breaks, be able to generate table of contents, etc.   I would like the format to stay as it is after generated.  The files are around 100 pages.

I would be grateful to hear of solutions/software for high quality output that does not involve a lot of time to learn or setup and are dynamically produced.  Not sure if I am asking too much, but would be glad to hear from those of you who have done this yourself.  The page breaks are giving me a bit of grief at the moment.  I can see how I could  list the chapters for a table of contents, but not how to pick up the page numbers.

Thanks

Debbie

0
Comment
Question by:debbieau1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 3

Accepted Solution

by:
sow56091 earned 1000 total points
ID: 13659751
Hi debbieau1,

Try RandOs' PHP PDF creation library: http://www.ros.co.nz/pdf 

It's free, easy to set up, requires no rebuild of PHP or Apache, and is well documented, plus it works great with tables.

Cheers!
0
 
LVL 32

Assisted Solution

by:Batalf
Batalf earned 500 total points
ID: 13659763
PDF is the definitive choice.

There are several alternatives

1) Generate the whole content from scratch using PDFLib - Library for PDFLib is embedded in PHP, but you will need a license in order to get PDFs without watermarks.

2) Use HTML->DocBook->FOP->PDF transformation.

Convert your content to DocBook(a XML format), then use FOP to convert it to PDFs. There's a lot of sources

Check out

http://xml.apache.org/fop/

Batalf
0
 
LVL 1

Author Comment

by:debbieau1
ID: 13660317
Hello

Thanks very much for the responses.  Firstly the RandO's appears to be non commercial use, and I do need this for work, so I don't think that will do.

I am hoping for a solution which will be really quick to learn if possible.   I haven't time to learn xml for this project, although am defniitely interested in this.  I really need something quick to get this project out.  

I would be very grateful if you have any other suggestions, even if it means purchasing some reasonably priced software.  The time to learn is the biggest problem for this project.

The main thing is to be able to get the page breaks in. accurately.  Heading styles are working fine from the css style sheet and for this one I could do without the table of contents if I have to, although it would be great if there was a quick answer to this.

Debbie

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 32

Expert Comment

by:Batalf
ID: 13660328
You can try this one:

http://www.digitaljunkies.ca/dompdf/

I haven't tested it, but it looks promising.
0
 
LVL 1

Author Comment

by:debbieau1
ID: 13660389
Had a look at the digitaljunkies link, thanks and yes it does look promising, but it says it does not support  bullets which I have in several areas of the file.

Also, I am not clear with dynamic pdf generation, does it  keep any formatting put in from CSS or is one starting from scratch with formatting?
0
 
LVL 3

Expert Comment

by:sow56091
ID: 13660450
Why do you say "Firstly the RandO's appears to be non commercial use?"

The documentation says, "This class is designed to provide a non-module, non-commercial alternative to dynamically creating pdf documents from within PHP."

This means that you are not *paying* to use it. It is free software as well as being recommended by Oreilley's Hugh E. Williams & David Lane who wrote "Building Effective Database-Driven Web Sites"

If you go to http://www.webdatabasebook.com/
"In this section, we show you how to use R&OS Ltd's free PHP PDF creation library (we refer to this as pdf-php throughout this section) The library has two advantages over other approaches it's free and it doesn't require any additional PHP configuration What's more, it's powerful and you can do most things you need, including producing tables containing results from database queries and inserting images into a document."
0
 
LVL 13

Assisted Solution

by:bochgoch
bochgoch earned 500 total points
ID: 13660464
FPDF is my choice, all the joy of PDFlib without the need for a licence...

www.fpdf.org
http://directory.fsf.org/text/misc/FPDF.html

It's easy to set up, you'll probably want to write some PHP code to generate some standard output -- header, footer, table, toc etc...certainly provided what I needed....

bg
0
 
LVL 1

Author Comment

by:debbieau1
ID: 13660630
I'm sorry about the RandO.  I skimmed the readme file, and I think I read the non commercial as not for commercial use, but just looking back,  yes I think it is fine.    Sorry about that.  A bit too tired I think.  

Thanks very much eveyrone.  I will split the points and hope that is fair.

Thanks again.
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question