Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > edit PDFs

edit PDFs
Thread Tools
madmacgames
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
Feb 24, 2005, 04:24 PM
 
Does anyone know if it is possible to edit a PDF file with PHP?

For example, say I have a document template set up with some fields that need filled in on a per user basis. Rather than generating the PDF from scratch, I'd like to be able to save that template as a PDF, have PHP open it, and be able to insert the data, and resave it.

I'm not if this is possible. I've been looking around haven't found anything, but thought I'd ask.

Though might just use RTF since the text is stored as plain text in the file. But I hate how neither Page nor TextEdit support embedded images or tables in RTF, thus forcing the user to have MS Word, whereas a PDF is more universal.
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
     
Millennium
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Feb 24, 2005, 09:19 PM
 
PHP has an extension for this; I think it's called pdflib or libpdf or something like that. I don't have any experience with it, so I'm not certain if it does exactly what you want, but it would be a good place to look.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
Simon Mundy
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Feb 25, 2005, 12:46 AM
 
Originally posted by madmacgames:
Does anyone know if it is possible to edit a PDF file with PHP?
Good news - yes, it's all possible.

Bad news - you need to pay a reasonably large licence to use that functionality.

Visit http://www.pdflib.com/ and view the price for PDF + PDI (PDF Import)

If the budget's not a problem, then dive right in. I've written a complete PDF import library for another client, so if you need any pointers I can certainly help out.
Computer thez nohhh...
     
Balneum
Fresh-Faced Recruit
Join Date: Feb 2005
Location: Finland
Status: Offline
Reply With Quote
Mar 14, 2005, 04:47 AM
 
"Solitido coeli junua."

iBook G4/1,2 GHz
768 MB
60 GB
     
l008com
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
Reply With Quote
Mar 18, 2005, 11:55 AM
 
Another suggestion would be to make a default PDF with values like {USER_NAME} and {USER_ADDRESS}. Then when the file is requested, have PHP read the file in, substitute the info in the file, and then echo it out as a pdf document. That should make it download as a normal PDF with custom info inside. That SHOULD work, though I've never really taken a hard look inside a pdf document, that might effect layout etc.
     
   
 
Forum Links
Forum 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 On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 10:12 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,