Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

How to edit parts of a writable PDF using PHP?

pdf

  • Please log in to reply
9 replies to this topic

#1 Vaielab

Vaielab

    Programming God

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1382 posts
  • Location:Quebec City
  • Programming Language:Java, C++, C#, PHP, JavaScript, Visual Basic .NET, Transact-SQL, ActionScript

Posted 25 October 2011 - 05:52 PM

Hello,

Each year, my client is forced by law (stupid québec) to get a pdf from the governement website, and fill it (a pdf that you can write in it), print it, keep a copie, and send it to our governement.
And he has to do this for each of his client (maybe 600-700) so it take a lot of time. And for each client, he has to get a new pdf from the website since they are all the same exept the barcode at the bottom.

Since I have all the data the governement ask inside a database, I was thinking of doing something that could do it for them.
I already have a script that can download a new pdf for each client, but I don't know how to write inside a writable pdf in PHP.

Anyone has already did something like that?
  • 0

#2 Orjan

Orjan

    CC Mentor

  • Moderator
  • 2918 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#

Posted 25 October 2011 - 10:15 PM

I believe this page might help you. Using HTML forms to fill in PDF fields with PHP and FDF I just googled on "fill in pdf form with php" and got a bunch of hits...
  • 0

I'm a System developer at XLENT Consultant Group mainly working with SugarCRM.
Please DO NOT send mail or PM to me with programming questions, post them in the appropriate forum instead, where I and others can answer you.


#3 Vaielab

Vaielab

    Programming God

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1382 posts
  • Location:Quebec City
  • Programming Language:Java, C++, C#, PHP, JavaScript, Visual Basic .NET, Transact-SQL, ActionScript

Posted 26 October 2011 - 06:20 AM

Thx for the quick answer.
But sadly this will not help me.
The code is for creating a new pdf.
I want to modify some part of a existing pdf, as I would do normally with a writable pdf.
  • 0

#4 Orjan

Orjan

    CC Mentor

  • Moderator
  • 2918 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#

Posted 26 October 2011 - 01:58 PM

I guess you could take all other info in the original pdf file and add the form content into a new file?
  • 0

I'm a System developer at XLENT Consultant Group mainly working with SugarCRM.
Please DO NOT send mail or PM to me with programming questions, post them in the appropriate forum instead, where I and others can answer you.


#5 Alexander

Alexander

    YOL9!

  • Moderator
  • 3963 posts
  • Location:Vancouver, Eh!
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, Perl, Delphi/Object Pascal, Visual Basic .NET, Assembly, Fortran, Bash, Others

Posted 30 October 2011 - 02:55 AM

Although it seems valid, this goes in to a bit of a vague area of PHP's scope.

If you can afford the time to implement a Zend framework module, they have one that updates every so often - it should be able to modify existing PDF documents:
Zend_Pdf tutorial

If memory serves me, you should be able to search for the item you wish to replace and insert another, you will have to dig around the documentation.
  • 0

All new problems require investigation, and so if errors are problems, try to learn as much as you can and report back.


#6 Vaielab

Vaielab

    Programming God

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1382 posts
  • Location:Quebec City
  • Programming Language:Java, C++, C#, PHP, JavaScript, Visual Basic .NET, Transact-SQL, ActionScript

Posted 30 October 2011 - 05:02 AM

I did read about the pdf module of zend framework.
But is it possible to use it without using the zend framework?
  • 0

#7 KtueethallLee

KtueethallLee

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 22 June 2014 - 07:30 PM

Actually, we can refer to a pdf document compatible barcode library to create, save and print barcode on pdf document, just like some excel barcode add-in and Word barcode add-on.


  • 0

#8 seandale

seandale

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 16 December 2014 - 11:19 PM

Actually, we can refer to a pdf document compatible barcode library to create, save and print barcode on pdf document, just like some excel barcode add-in and Word barcode add-on.

Does anyone know of a good method for editing PDFs in PHP? Preferably open-source/zero-license cost methods. :)

I am thinking along the lines of opening a PDF file, replacing text in the PDF and then writing out the modified version of the PDF?

I have programmatically created PDF files in the past using FPDF, but found it a little unwieldy at times.


  • 1

#9 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts
  • Location:Argentina
  • Programming Language:C, C++, C#, PHP, JavaScript, Transact-SQL, Bash, Others
  • Learning:Java, Others

Posted 17 December 2014 - 07:33 PM

I second seandale. You should take a look at FPDF.


  • 0

#10 seandale

seandale

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 17 December 2014 - 08:37 PM

I second seandale. You should take a look at FPDF.

Thanks,I will take a look at it.


  • 0





Also tagged with one or more of these keywords: pdf

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download