Jump to content

Db info to pdf


Kay1021

Recommended Posts

Is there a way to take your data from your db and create a pdf.

 

Basically i have a table of information sectioned by month and I want to give the user the option to save that information, ideally in pdf format so they can have a copy and print etc. I want them to be able to choose by month or all the months.

 

 

 

Thanks

Link to comment
Share on other sites

I took a look at that...and i've been trying to search google...but i'm not sure i'm getting it. In the fpdf thing the examples just show them filling it with information like Hello World or from a text doc....i'm just not sure how I do it from the database....my information is already presented on the screen in a table...i'm just not understanding how to transform that into a pdf using that fpdf.

 

I was hoping there was a simple tutorial out there...but i haven't found one yet. Thanks for the suggestions though

Link to comment
Share on other sites

There are several solutions to your problem and I expect each of them will require you to learn some new things. Here are a few possibilities

 

1) Get a 3rd party, server-side utility that will allow you to "point" the utility to the web page in question and output a PDF of the page. This would probably be the simplest solution, but it will cost money and the format of the PDF will look just like the HTML page (unless you provide code to handle the page differently for the PDF creation). Personally I would think the PDF should be constructed differently than the HTML representation. This would require installation of the 3rd party app. If you're on a shared server this may not be possible.

 

2) Use PHP's built in PDF creation functionality: http://us2.php.net/pdf This will require you to learn all the ins and outs of this process. It will probably take the most time, but you will get the most personal benefit from it. And it would be free. This requires that this functionality is enabled on the server. May be an issue for a shared server that you do not control.

 

The link theonlydrayk posted above appears to be a Class that utilizes PHPs built in functionality but makes the process easier to implement. See comments below.

 

3) Implement some other 3rd party tool for PDF creation. This can be various implementation such as creating raw PostScript code and distilling it on the server using Adobe product or other tools (e.g. Active PDF). Or it could be something proprietary. This will give you the greatest amount of flexibility. But, it will cost money and will bethe most difficult to master. This would require installation of the 3rd party app. If you're on a shared server this may not be possible.

 

 

I think #2 is what you want. The "Hello World" example is just that - an example. You would want to create your own code to have the dynamic content from the database used instead. Since we don not know your content or how you want it output, you are on your own at this point.

Link to comment
Share on other sites

Thanks...i guess i'll try #2....might take me a while...but hopefully i figure it out... basically my table is like

 

TASK                              |    CHECK      |          DATE            |        COMMENT

----------------------------------------------------------------------------------------------------

Clean bathroom                |      YES        |        09/10/08        |    Done by Fred

----------------------------------------------------------------------------------------------------

Wash dog                        |      NO          |        29/12/08        |    Dog unavailable

----------------------------------------------------------------------------------------------------

Sweep Floors                  |      YES        |        01/04/09        |    No problems

----------------------------------------------------------------------------------------------------

Wash Windows                |      YES        |        11/05/09        |    Window broke

 

all that information is from the database

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.