Jump to content


Dynamic PDF Creation

  • Please log in to reply
2 replies to this topic

#1 Crimpage

  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts
  • LocationBrisbane, Australia

Posted 16 May 2006 - 12:53 AM

Hey everyone,

I'm starting to do some work where dynamic PDF creation would be REALLY helpfull. I have played a bit but just with standard, write text, continue text and place image etc...

What I will be doing, is outputting a report to a PDF where the data could be 1 line, 2 paragraphs or 2 pages.

How can I work out how much of the page was taken up by the text, then put a border around it etc...

Any info is appreciated.



#2 Barand

  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 16 May 2006 - 06:20 PM

Have you looked at FPDF?

[a href=\"http://www.fpdf.org\" target=\"_blank\"]http://www.fpdf.org[/a]

Its cell() and multicell() functions will output text and put the border round it.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received


|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 Psycho

  • Moderators
  • Move along, nothing to see here
  • 11,892 posts
  • LocationCanada

Posted 17 May 2006 - 03:41 PM

What is your process for creating the PDFs? Are you pasing an HTML page to a PDF library function or are you creating dynamic psotscript files and distilling them?

If you are doing the former, you will need to use strict styles within the HTML page to control the output. For example, knowing that there are 72 pixels (or points) per inch. So if you want 1" margins on the sides you should create a table with an exact width of 72 x 6.5. And then specify an exact point size for the font. Then put a border on the containing table(s). Depending on the type of format for your data, you may or may not be able to control page breaks (there is a CSS control for page breaks).

If you are building the PDFs by creating postscript first, you have FULL control over all elements. You would just need to learn PostScript programming!
The quality of the responses received is directly proportional to the quality of the question asked.

I do not always test the code I provide, so there may be some syntax errors. In 99% of all cases I found the solution to your problem here: http://www.php.net

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users