OM2 Posted October 5, 2017 Share Posted October 5, 2017 I need to edit an existing PDF and add text. I need to first search for a string. From the location where the string is matched, I want to add text 1.5cm below. Is this possible? The PDF has no protection or anything - just plain PDF. What code libraries do I need? Thanks. Quote Link to comment Share on other sites More sharing options...
phpmillion Posted October 6, 2017 Share Posted October 6, 2017 If you use Zend Framework, it supports editing PDF by default. However, I'm not very sure about your needs? Are you looking for a way to open, modify and save PDF file itself using PHP? Or do you just need to get content from PDF, modify it, and then output modified content on website? Quote Link to comment Share on other sites More sharing options...
ginerjm Posted October 6, 2017 Share Posted October 6, 2017 Why do you need PHP to edit a PDF? Quote Link to comment Share on other sites More sharing options...
OM2 Posted October 6, 2017 Author Share Posted October 6, 2017 thanks for the replies guys. it's to edit labels from a courier. they give 4 labels per sheet. for each order you can have a 12 digit reference - NOTHING else. it would be great if i could have an area of text where i could put all order details. so... the code would read in a csv with full order details - with many orders... search for the 12 digit reference string... and then below add more information for the order. overwriting PDF or making a new one - either would be ok. let me know what u guys think. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted October 6, 2017 Share Posted October 6, 2017 The key thing if I understand correctly would be to be able to use PHP to read the pdf doc. Then with the info from that you can create your own new doc (pdf or not) by combining your info with the pdf's data. No reason to be outputting a new pdf is there? Unless you need to create a specific image that must fit some exact format which a pdf creator can do. Personally I use FPDF which is pretty darn accurate and not too difficult to pick up. Quote Link to comment Share on other sites More sharing options...
Barand Posted October 6, 2017 Share Posted October 6, 2017 IMHO it would be easier to create a PDF rather than edit an existing one. EG http://www.fpdf.org Quote Link to comment Share on other sites More sharing options...
ginerjm Posted October 6, 2017 Share Posted October 6, 2017 That makes two of us. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.