UnitedForums - UK Web Hosting Forum UnitedHosting Community Hosting Forums
Network and Server StatusCustomer SupportUK Web Hosting
UnitedHostingUnitedHosting Sitemap UK Hosting ForumUK Web HostingWeb Hosting ForumsUK Reseller HostingWeb Host CommunityUK Managed Dedicated ServersHosting Help and SupportUK Domain Name Registration

Go Back   UnitedForums.co.uk > UnitedHosting Community > Website Development & Scripting

Reply
 
Thread Tools Rate Thread Display Modes
Old 22nd June 2007, 02:56 PM   #1 (permalink)
explorer
Explorer
 
Join Date: Feb 2006
Location: North East of England
Posts: 5
Generating PDF's using PHP.

I'm attempting a PHP tutorial from a magazine which will, if successful, enable PDF's to be generated from a web page.

It requires the PDF extrension to be installed. I've had a quicklook to see if it's enabled or installed (i uploaded a phpinfo.php file) but can't see any reference to it. Is it something that UH can add?

I'm a beginner with PHP, so any help is appreciated.

Thanks

Steve
explorer is offline   Reply With Quote
Old 22nd June 2007, 05:46 PM   #2 (permalink)
TygerTyger
Lumberjack and OK
 
Join Date: Aug 2004
Posts: 833
It appears to be installed already, unless my PDF converter is working by voodoo.
TygerTyger is offline   Reply With Quote
Old 22nd June 2007, 06:53 PM   #3 (permalink)
Terra
Registered User
 
Terra's Avatar
 
Join Date: Oct 2005
Location: old cottage
Posts: 945
Waiting for my .net magazine in the post - hopefully it'll be here tomorrow - the PHP PDF converter tutorial sounds interesting!
__________________
Underground, Overground, Wombling Free!
Terra is offline   Reply With Quote
Old 23rd June 2007, 07:17 PM   #4 (permalink)
explorer
Explorer
 
Join Date: Feb 2006
Location: North East of England
Posts: 5
I'm following the .NET tutorial as well

I've got it to work locally (WAMP), but haven't figured out the correct path to put the 'output.pdf' in on UH.

You have to change the /dev/net/output.pdf bit to wherever you want to have the pdf file saved.

pdf_open_file($pdf, "/dev/net/output.pdf");

Last edited by explorer : 23rd June 2007 at 07:18 PM. Reason: wrong emoticon
explorer is offline   Reply With Quote
Old 23rd June 2007, 09:00 PM   #5 (permalink)
Samizdata
Virtual Dilettante
 
Join Date: Nov 2006
Location: Planet Earth
Posts: 182
A slightly different take on this, but Apple's Safari browser can save pages, including this one, in PDF format by choosing File > Print > PDF (it requires no tutorial).

Presumably it is available in the Windows version of Safari, and there are Firefox extensions to do the same thing. There are also third-party add-ons for IE7 but apparently they don't work in the default "Protected Mode".

You may have your reasons for wanting the file created on the server, though.
Samizdata is offline   Reply With Quote
Old 24th June 2007, 09:38 AM   #6 (permalink)
Adam
mmmm I LOVE Apples ;)
 
Adam's Avatar
 
Join Date: Nov 2005
Location: My House
Posts: 1,462
Send a message via AIM to Adam Send a message via MSN to Adam Send a message via Yahoo to Adam
It makes more sense to have it created on the server. You can't guarantee what browser the client is using
Adam is offline   Reply With Quote
Old 24th June 2007, 12:43 PM   #7 (permalink)
Samizdata
Virtual Dilettante
 
Join Date: Nov 2006
Location: Planet Earth
Posts: 182
As I said, people may have their reasons - it's just that I can't think of any.

I would be concerned about possible "duplicate content" issues with Google.

I may well be missing the point, of course...
Samizdata is offline   Reply With Quote
Old 24th June 2007, 02:59 PM   #8 (permalink)
desquinn
Senior Member
 
Join Date: Dec 2005
Location: Paisley
Posts: 332
A good reason for having this is part of an invoicing system so the invoice can be generated on the fly into a PDF format....
desquinn is offline   Reply With Quote
Old 24th June 2007, 03:10 PM   #9 (permalink)
MRobinson
Senior Member
 
MRobinson's Avatar
 
Join Date: Sep 2004
Location: UK
Posts: 106
Creating the PDF file on the server is the best approach IMO since it does not limit you. On the server it would be straight-forward to "email this PDF to a friend" for example - not sure how that would be achieved client-side without user intervention.

Also, printing the page as PDF can give different results from what's required. e.g. I generate PDF invoices that look entirely different from the displayed page (with letterhead, terms and conditions etc) - although you could do a lot with a print media stylesheet I suppose.

There are plenty of pure PHP alternatives that don't require the PHP extension.
e.g. FPDF, or Zend_Pdf (php5) amongst many others.
__________________
Mark
Get Firefox | SitePoint

"It's difficult to get a man to understand something when his salary depends on his not understanding it" - Upton Sinclair
MRobinson is offline   Reply With Quote
Old 24th June 2007, 03:22 PM   #10 (permalink)
Samizdata
Virtual Dilettante
 
Join Date: Nov 2006
Location: Planet Earth
Posts: 182
Thanks - I took the OP's post ("enable PDF's to be generated from a web page") as dealing with converting an existing HTML page to PDF, and couldn't understand why anyone would want to.

I use print media stylesheets on almost everything.

Last edited by Samizdata : 24th June 2007 at 03:28 PM.
Samizdata is offline   Reply With Quote
Old 12th July 2007, 05:11 PM   #11 (permalink)
RoryB
Regular Member
 
Join Date: Aug 2006
Posts: 49
Quote:
Originally Posted by Terra View Post
Waiting for my .net magazine in the post - hopefully it'll be here tomorrow - the PHP PDF converter tutorial sounds interesting!
Do you know if this tutorial is available online at all? Or if this will work on UH?

Last edited by RoryB : 12th July 2007 at 05:15 PM.
RoryB is offline   Reply With Quote
Old 12th July 2007, 09:10 PM   #12 (permalink)
ijl
Just hangin' around!
 
ijl's Avatar
 
Join Date: Mar 2006
Location: Suffolk - UK
Posts: 138
Send a message via MSN to ijl
It's not available online from the original source which the latest issue of .net magazine. The Website is at Home - .net magazine but although quite a bit of the content is available online after publication I couldn't see this article.

They also publish the files on a CD with the mag - so you'll need to get a copy of the mag I'm afraid.
__________________
"Old web developers don't die, they degrade gracefully..."

Seen on www.socialsignal.com

Last edited by ijl : 12th July 2007 at 09:11 PM. Reason: spelling!
ijl is offline   Reply With Quote
Old 27th May 2008, 07:21 PM   #13 (permalink)
Charles
Registered User
 
Join Date: Sep 2007
Location: 17°59′N 76°48′W
Posts: 150
I came across this post by accident but I am sure glad that I did.
I didn't know about Zend_PDF and now I will be looking into using it.
Charles is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 03:47 PM.

UK Web Hosting  |  UK Reseller Hosting  |  UK Dedicated Servers UnitedHosting  |  UnitedSupport  |  UnitedForums  |  SEO by vBSEO 3.0.0
Copyright © 1998-2008 United Communications Limited. All Rights Reserved. Registered in England and Wales 3651923 - VAT Reg No. 737662309