WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-04-2007, 04:34 PM
Tim's Avatar
Tim Tim is offline
WebProWorld Veteran
 

Join Date: Jul 2004
Location: On the edge of the UK
Posts: 448
Tim RepRank 0
Default Form data to PDF

I would like to enable authors to submit articles of 10-30,000 words via a form that would then be automatically converted into PDFs. The idea is that the form format would separate title, author, main text and bibliography/credits and then a script would put them all together according to a style sheet. I would like the resulting PDFs to be saved to the server, added to a database and be accessible to all visitors automatically and almost instantly via a chronological list.

What's the best way to do it please?
__________________
Pleasure in the job puts perfection in the work. Aristotle (384-322 BC)
Reply With Quote
  #2 (permalink)  
Old 04-04-2007, 05:11 PM
DaveSawers's Avatar
WebProWorld Veteran
 

Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 354
DaveSawers RepRank 1
Default

PHP allows you to put material directly into a new PDF file. It can also put data into a MySQL database for you.

BUT... Why would you want to put the data into a PDF?

If all the necessary stuff is input via a form and stored on the database, why not display the data directly from the database in a PHP page. That way you can change the format down the road by editing the PHP/CSS instead of having to rebuild every PDF file.
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote
  #3 (permalink)  
Old 04-04-2007, 05:23 PM
Tim's Avatar
Tim Tim is offline
WebProWorld Veteran
 

Join Date: Jul 2004
Location: On the edge of the UK
Posts: 448
Tim RepRank 0
Default

Thanks Dave,

I thought PHP/MySQL would be the way to go but I don't know how to do it. The PDF output idea was because we want visitors to be able to print the files easily. Reading 10-30,000 words for each article on-screen would be a tough task.
__________________
Pleasure in the job puts perfection in the work. Aristotle (384-322 BC)
Reply With Quote
  #4 (permalink)  
Old 04-04-2007, 10:12 PM
nullvariable's Avatar
WebProWorld Pro
 

Join Date: Sep 2005
Location: Greenville, SC
Posts: 214
nullvariable RepRank 1
Default

PHP is certainly the best method to use but the programming required to make this happen is not simple. I would suggest combining both the database and PDF to handle tracking and searching more easily. There are many freelancers out there and on these forums that are capable of handling such a project.
__________________
Blog | Web Consulting
Reply With Quote
  #5 (permalink)  
Old 04-05-2007, 09:08 AM
DaveSawers's Avatar
WebProWorld Veteran
 

Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 354
DaveSawers RepRank 1
Default

With the right CSS setup, printing nicely to read is straightforward. I would definately avoid PDF unless you have a really good reason for using it.

Setting up the PHP for this is pretty simple. I doubt it's much more than an hours work. E-mail me: david@activeminds.ca with all the details if you want some help and I'll send you a quote.
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote
  #6 (permalink)  
Old 04-05-2007, 09:14 AM
Tim's Avatar
Tim Tim is offline
WebProWorld Veteran
 

Join Date: Jul 2004
Location: On the edge of the UK
Posts: 448
Tim RepRank 0
Default

Thanks nullvariable and Dave.

Dave I will contact you soon.

Thanks again,

Tim
__________________
Pleasure in the job puts perfection in the work. Aristotle (384-322 BC)
Reply With Quote
  #7 (permalink)  
Old 04-06-2007, 06:50 AM
WebProWorld Member
 

Join Date: Apr 2007
Location: Delaware
Posts: 38
seomagnet RepRank 0
Default

>I would like to enable authors to submit articles of 10-30,000 words via a form

Do you already have a web site up and are looking to add this functionality?

There are many well known open source programs such as Joomla that work as articles sites, allow contents to be emailed, printed or saved as pdf. Joomla is also free but has a huge userbase with thousands of plugins.

However, if you already use a custom solution, Joomla wouldn't work.

Just a thought,
Chris

BTW: PDF articles are also indexed via many search engines like Google, Yahoo, Fast, Alltheweb ECT. PDF's files can also bring additional traffic. Just make sure the author has credit in the file with a link saying it came from your site.
Reply With Quote
  #8 (permalink)  
Old 04-06-2007, 06:58 AM
WebProWorld Member
 

Join Date: Apr 2007
Location: Delaware
Posts: 38
seomagnet RepRank 0
Default

Hello,
Also, if you check out pdflib.org, you can do this using php and mysql easily.

Here are the basics.

Code:
<?php 
// create handle for new PDF document 
$pdf = pdf_new(); 

// open a file 
pdf_open_file($pdf, "philosophy.pdf"); 

// start a new page (A4) 
pdf_begin_page($pdf, 595, 842); 

// get and use a font object 
$arial = pdf_findfont($pdf, "Arial", "host", 1); pdf_setfont($pdf, $arial, 10); 

// print text 
pdf_show_xy($pdf, "There are more things in heaven and earth, Horatio,", 50, 750); pdf_show_xy($pdf, "than are dreamt of in your philosophy", 50, 730); 

// end page 
pdf_end_page($pdf); 

// close and save file 
pdf_close($pdf); 
?>
You would have to input the correct php tags above but overall, is very easy to do.

Hope this helps,
Chris
Reply With Quote
  #9 (permalink)  
Old 04-06-2007, 06:59 AM
Tim's Avatar
Tim Tim is offline
WebProWorld Veteran
 

Join Date: Jul 2004
Location: On the edge of the UK
Posts: 448
Tim RepRank 0
Default

Thanks Chris,

The site is still at the planning stage and I am currently developing the specification. I am familiar with Joomla and am building another site with it at the moment. I'll search through the extensions to see if there's something that will do the job.

Cheers

Edit: Thanks for the code
__________________
Pleasure in the job puts perfection in the work. Aristotle (384-322 BC)
Reply With Quote
  #10 (permalink)  
Old 04-06-2007, 07:03 AM
WebProWorld Member
 

Join Date: Apr 2007
Location: Delaware
Posts: 38
seomagnet RepRank 0
Default

Sorry for posting again. I said pdf.org but that was wrong. The correct URL is;

http://www.pdflib.com/pdflib-gmbh/

Chris
Reply With Quote
  #11 (permalink)  
Old 04-06-2007, 07:18 AM
Tim's Avatar
Tim Tim is offline
WebProWorld Veteran
 

Join Date: Jul 2004
Location: On the edge of the UK
Posts: 448
Tim RepRank 0
Default

Excellent link! Looks like just the thing, thanks.

Why are PDFs unpopular with some developers? Dave, if you're still following this, why would you 'avoid PDF unless you have a really good reason for using it'?
__________________
Pleasure in the job puts perfection in the work. Aristotle (384-322 BC)
Reply With Quote
  #12 (permalink)  
Old 04-06-2007, 07:27 AM
WebProWorld Member
 

Join Date: Apr 2007
Location: Delaware
Posts: 38
seomagnet RepRank 0
Default

Hello Tim,

Read your last post. I am no longer really into the developer side of this unless I need it for a specific purpose.

However, in regards to PDF, I am simply busy all of the time. So I come across a lot of good articles about things but I don't have the time to sit at the site and read an entire article. So I can save a pdf file to read later in the evening when things slow down.

One site I visit a lot, http://www.bizreport.com/ offers whitepapers usually in standard pdf format.

PDF files I'm guessing are a matter of personal opinion for many but for myself. I find them useful.

Just my thoughts,
Chris
Reply With Quote
  #13 (permalink)  
Old 04-06-2007, 09:09 AM
DaveSawers's Avatar
WebProWorld Veteran
 

Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 354
DaveSawers RepRank 1
Default

Quote:
Originally Posted by Tim
Dave, if you're still following this, why would you 'avoid PDF unless you have a really good reason for using it'?
In short, PDF is old technology. Time to move on.

PDFs usually take longer to download than HTML pages. Their format is fixed and inflexible.

The only real use for a PDF is to print it and read it later (something I never do). Even if this is your preference, it can be achieved with CSS which can also give you a dynamic screen layout that changes to suit the browser size you like to use.
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote
  #14 (permalink)  
Old 04-06-2007, 04:18 PM
WebProWorld New Member
 

Join Date: Sep 2005
Location: Indianapolis, IN
Posts: 6
Jermooski RepRank 0
Default Form Data to Pdf

Hello Tim,

I'm new to this board, but thought Id throw in a couple pennies.

I work for a custom dev shop, and we have been creating dynamic/automated pdf documents in one form or another since Acrobat v3. It is an old technology, but it still works. There's nothing wrong with it. There are other methods to render text, CSS has been mentioned, this will work well for the browser. Currently, we use XSLFO, which gives you nice control over page layout when rendering dynamic content.

I would suggest just building an administrative area that would allow a user to choose PDF or HTML versions.

Your project is pretty straightforward, you just need to find a good web developer. Things to think about... the pdf storage may become an issue, size wise, and portability issues. Also, think about access levels in your admin area. Someone may need to edit the docs, while others can only pull down and view.

The one "gotcha" in the project may be in HOW an author posts up an article/story. They probably aren't going to write the whole thing on your website form field. They will be using all sorts of crazy text editors each with differing character subsets. Try allowing users to copy paste 10 pages from MSWord... Fun fun fun! Getting clean data in the DB is important.

Ramble is over.... Back to your question.

What's the best way to do it? Hire a good web programmer with a SQL/PHP/PDF/XML/XSL track record.

Jeremy H.
Reply With Quote
  #15 (permalink)  
Old 04-07-2007, 04:46 AM
Tim's Avatar
Tim Tim is offline
WebProWorld Veteran
 

Join Date: Jul 2004
Location: On the edge of the UK
Posts: 448
Tim RepRank 0
Default

Very useful stuff Jermooski,

PDF was my chosen format because we believe most visitors will be printing our 'articles/stories' to read later. CSS is the best way to format both screen and print pages but, as far as I know, PDFs are unique and universal as 'packages'. They are bulky and compared to XHTML pages, slow to load, but they are searchable and a handy format to pass around. They may well be superseded by a fresh technology but, as I understand it, Adobe are still developing the technology.

We realise that we need to hire a programmer and are already advertising. Your suggested skill set will be very useful.

Thank you.
__________________
Pleasure in the job puts perfection in the work. Aristotle (384-322 BC)
Reply With Quote
  #16 (permalink)  
Old 04-28-2007, 01:51 AM
Skywoolf's Avatar
WebProWorld Member
 

Join Date: Aug 2005
Location: Hong Kong & Philippines
Posts: 60
Skywoolf RepRank 0
Default Creating PDF files on the fly

Tim,
I hope you don't mind me "hijacking" this thread but I have almost the same problem so it seems sensible not to start a new thread.

I am producing web sites for insurance and would like to generate policies, cover notes, etc on the fly so people can download them and print them. PDF would seem ideal because they can't change them.

Each one would need to have the users details inserted into an otherwise standard PDF file. The only other way I can think of is to generate a printer friendly page that they can print but not save. However this means problems with different fonts possibly making the layout into a mess.

So far I have not found any reliable way to do this but would really appreciate any advice.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , ,



Thread Tools
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

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


Search Engine Optimization by vBSEO 3.2.0