Bluehost.com Web Hosting $6.95

Create PDFs with a strict layout automatically

This is a discussion on Create PDFs with a strict layout automatically within the PHP General forums, part of the PHP Programming Forums category; Hi, I want to offer visitors of my site the possibility of downloading printable, foldable pocket guides for certain things ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-27-2007
David Christopher Zentgraf
 
Posts: n/a
Default Create PDFs with a strict layout automatically

Hi,

I want to offer visitors of my site the possibility of downloading
printable, foldable pocket guides for certain things that come out of
my database. The problem is that items will be entered into the
database very frequently, so I need to automate the process of
creating these guides. Since they're supposed to work like flyers,
with a proper front and back etc, the layout will need to be very
strict and adhere to a template. I was thinking about PDFs, since they
should keep their layout in print no matter what. But how would I
create PDFs from a template on the fly using PHP?
Or is HTML with a special print style sheet the better solution?

Anybody have any experience?

Chrs,
Dav
Reply With Quote
  #2 (permalink)  
Old 11-27-2007
Chris
 
Posts: n/a
Default Re: [PHP] Create PDFs with a strict layout automatically

David Christopher Zentgraf wrote:
> Hi,
>
> I want to offer visitors of my site the possibility of downloading
> printable, foldable pocket guides for certain things that come out of my
> database. The problem is that items will be entered into the database
> very frequently, so I need to automate the process of creating these
> guides. Since they're supposed to work like flyers, with a proper front
> and back etc, the layout will need to be very strict and adhere to a
> template. I was thinking about PDFs, since they should keep their layout
> in print no matter what. But how would I create PDFs from a template on
> the fly using PHP?


There are a few packages you can use.

http://pear.php.net/package/File_PDF
http://www.fpdf.org/

are two I know of, I'm sure there are more.

If you have the choice maybe the php extension is an option:

http://php.net/pdf

but that requires a module be built into php.

--
Postgresql & php tutorials
http://www.designmagick.com/
Reply With Quote
  #3 (permalink)  
Old 11-27-2007
David Christopher Zentgraf
 
Posts: n/a
Default Re: [PHP] Create PDFs with a strict layout automatically

On 27 Nov 2007, at 11:51, Chris wrote:

> There are a few packages you can use.
>
> http://pear.php.net/package/File_PDF
> http://www.fpdf.org/
>
> are two I know of, I'm sure there are more.


Thanks! The built-in PDFlib functions didn't seem to appealing, but
FPDF looks pretty good. I'll certainly play around with it to see what
it can do, but right of the bat it seems that templates aren't
supported the way I would like them to. Importing a PDF is possible,
but apparently they can only be treated like images.

Chrs,
Dav
Reply With Quote
  #4 (permalink)  
Old 11-27-2007
tedd
 
Posts: n/a
Default Re: [PHP] Create PDFs with a strict layout automatically

At 11:46 AM +0900 11/27/07, David Christopher Zentgraf wrote:
>Hi,
>
>I want to offer visitors of my site the possibility of downloading
>printable, foldable pocket guides for certain things that come out
>of my database. The problem is that items will be entered into the
>database very frequently, so I need to automate the process of
>creating these guides. Since they're supposed to work like flyers,
>with a proper front and back etc, the layout will need to be very
>strict and adhere to a template. I was thinking about PDFs, since
>they should keep their layout in print no matter what. But how would
>I create PDFs from a template on the fly using PHP?
>Or is HTML with a special print style sheet the better solution?
>
>Anybody have any experience?
>
>Chrs,
>Dav


Dav:

It can be done, check this out:

http://webbytedd.com/bb/pdf/

I created this by using:

http://www.fpdf.org/

You could just as easily pull it from a dB.

Cheers,

tedd


--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
Reply With Quote
  #5 (permalink)  
Old 11-27-2007
tedd
 
Posts: n/a
Default Re: [PHP] Create PDFs with a strict layout automatically

At 12:16 PM +0900 11/27/07, David Christopher Zentgraf wrote:
>On 27 Nov 2007, at 11:51, Chris wrote:
>
>>There are a few packages you can use.
>>
>>http://pear.php.net/package/File_PDF
>>http://www.fpdf.org/
>>
>>are two I know of, I'm sure there are more.

>
>Thanks! The built-in PDFlib functions didn't seem to appealing, but
>FPDF looks pretty good. I'll certainly play around with it to see
>what it can do, but right of the bat it seems that templates aren't
>supported the way I would like them to. Importing a PDF is possible,
>but apparently they can only be treated like images.
>
>Chrs,
>Dav



Dav:

You don't import the PDF's but rather create them on the fly.

Cheers,

tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
Reply With Quote
  #6 (permalink)  
Old 11-27-2007
Bastien Koert
 
Posts: n/a
Default RE: [PHP] Create PDFs with a strict layout automatically


you could also look at http://www.digitaljunkies.ca/dompdf/

bastien> CC: php-general@lists.php.net> From: deceze@gmail.com> To: dmagick@gmail.com> Date: Tue, 27 Nov 2007 12:16:45 +0900> Subject: Re: [php] Create PDFs with a strict layout automatically> > On 27 Nov 2007, at 11:51, Chris wrote:> > > There are a few packages you can use.> >> > http://pear.php.net/package/File_PDF> > http://www.fpdf.org/> >> > are two I know of, I'm sure there are more.> > Thanks! The built-in PDFlib functions didn't seem to appealing, but > FPDF looks pretty good. I'll certainly play around with itto see what > it can do, but right of the bat it seems that templates aren't > supported the way I would like them to. Importing a PDF is possible, >but apparently they can only be treated like images.> > Chrs,> Dav> > -- >PHP General Mailing List (http://www.php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php>
__________________________________________________ _______________
Have fun while connecting on Messenger! Click here to learn more.
http://entertainment.sympatico.msn.ca/WindowsLiveMessenger
Reply With Quote
  #7 (permalink)  
Old 11-27-2007
David Christopher Zentgraf
 
Posts: n/a
Default Re: [PHP] Create PDFs with a strict layout automatically

On 27 Nov 2007, at 12:25, Bastien Koert wrote:

> you could also look at http://www.digitaljunkies.ca/dompdf/


Looks alright, but I'm wondering whether the results might be more
accurate by laying the PDF out "by hand", instead of going through an
intermediary step with CSS? I was also looking at http://pdml.sourceforge.net
with the same mixed feelings.

Chrs,
Dav
Reply With Quote
  #8 (permalink)  
Old 11-27-2007
Brady Mitchell
 
Posts: n/a
Default Re: [PHP] Create PDFs with a strict layout automatically

David Christopher Zentgraf wrote:
> I'll certainly play around with it to see what it can do, but right of
> the bat it seems that templates aren't supported the way I would like
> them to. Importing a PDF is possible, but apparently they can only be
> treated like images.

I had a similar situation where I needed to fill in the blanks on an
existing PDF file. I used the createFDF function from
http://koivi.com/fill-pdf-form-fields in combination with pdftk
(http://www.accesspdf.com/pdftk/) to merge the fdf data and pdf file
into one.

Take a look at the fill_form and flatten options of pdftk.

Brady
Reply With Quote
  #9 (permalink)  
Old 11-27-2007
David Christopher Zentgraf
 
Posts: n/a
Default Re: [PHP] Create PDFs with a strict layout automatically

On 27 Nov 2007, at 14:09, Brady Mitchell wrote:

> I had a similar situation where I needed to fill in the blanks on an
> existing PDF file. I used the createFDF function from http://koivi.com/fill-pdf-form-fields
> in combination with pdftk (http://www.accesspdf.com/pdftk/) to
> merge the fdf data and pdf file into one.
>
> Take a look at the fill_form and flatten options of pdftk.


Thanks, but by now I'm pretty much sold on the idea of FPDF and
creating PDFs on the fly, inserting data I need as I go. Is there any
advantage using pdftk?

Chrs,
Dav
Reply With Quote
  #10 (permalink)  
Old 11-27-2007
Brady Mitchell
 
Posts: n/a
Default Re: [PHP] Create PDFs with a strict layout automatically

David Christopher Zentgraf wrote:
> Thanks, but by now I'm pretty much sold on the idea of FPDF and
> creating PDFs on the fly, inserting data I need as I go. Is there any
> advantage using pdftk?

The only advantage would be that others could create the PDFs and give
them to you.

I used this setup to allow region offices to send me the PDF that they
wanted to be used for generating reports for their users. I gave them a
list of field names and they were able to choose which ones to include
on the report, which order, etc.

FPDF is a great way to go - I've used it for other projects. Thought I'd
share this method so you'd have more options. :)

Brady
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:28 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0