Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Search and replace text on an existing PDF

3,981 views
Skip to first unread message

lopb

unread,
May 19, 2010, 6:00:38 PM5/19/10
to
Hi,

I look into the FPDF web site and i didn't find an answer to that
question. I have a pdf file with content and format, also i have the
doc(from wich the pdf has been generated). What i need is to edit that
PDF and replace some strings with other strings. All this with php
like
<?
open(myfile.pdf);
pdfreplace("original string","new string");
?>
indian code :D
thanks

Johannes Keßler

unread,
May 20, 2010, 2:32:43 AM5/20/10
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

well I've not done this but there is a way to read PDF documents:

http://davidwalsh.name/read-pdf-doc-file-php

So you need to read the PDF or even the doc file first, manipulate it and then
generate the PDF again.

Also there is fpdi:

http://www.setasign.de/products/pdf-php-solutions/fpdi/


regards,
johannes Ke�ler
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)

iEYEARECAAYFAkv014sACgkQE++2Zdc7EtfgqwCgqo5NrJC5kCvBtdLWyeIVPfyw
f/MAn1Fnv1UassmJAk9z2z7rcN8+S5/4
=i9Zu
-----END PGP SIGNATURE-----

C. (http://symcbean.blogspot.com/)

unread,
May 20, 2010, 7:19:50 AM5/20/10
to

Short answer is you can't.

Pdf is based on postscript - both are programming languages - NOT
markup languages. How would you write a program which inserts a CSS
file in **any** PHP file, regardless if it used any templating system
or any framework? Its just not practical.

You could try uncompressing the pdf file and do a text search replace
(have a google for pdftk) but this is only going to work if the string
your replacing is atomic within the PDF file and is not a pdf
function. Even if this works with test cases, the nature of PDF files
is that it will come back and bite you on the bum.

C.

0 new messages