Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > edit pdf
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 10857 of 12002
Post > Topic >>

edit pdf

by wolf.blaum@[EMAIL PROTECTED] (Wolf Blaum) Apr 4, 2008 at 02:54 AM

hi there,

I have a pile of pdf do***ents which may or may not contain email
adresses.
Now I do have to mask the xy@[EMAIL PROTECTED]
 adresses into something like
xyAT
whereever.dot

I looked at CAM::PDF and PDF::API2 -
my CAM::PDF code would look like

foreach my $file (@[EMAIL PROTECTED]
){
  my $doc=CAM::PDF->new($file);
  my $pagenumber = $doc->numPages();
  for (my $i=1; $i=$pagenumber; $i++){
    my $page=$doc->getPageContent($i);
    $page =~ s/\@[EMAIL PROTECTED]
    $doc->setPageContent($page);
  }
  $doc->save();
}

That however keeps on repeating a loop somewhere in CAM::PDF forever:

--snip--
ET Tw ( ) TjTD25 0.75 re fw ( ) Tjrbara.uebe@[EMAIL PROTECTED]
) Tjrite.de/) Tj)
Tjanke Kinder, CVK) Tjj
Use of uninitialized value in hash element at
/usr/lib/perl5/site_perl/5.8.5/CAM/PDF.pm line 2811.
Argument "BT\r70.5 49.5  TD\r0 0 0 rg \r/F0 9.75  Tf\r-0.2025  Tc ..."
isn't
numeric in numeric lt (<) at /usr/lib/perl5/site_perl/5.8.5/CAM/PDF.pm
line
2060.
ET Tw ( ) TjTD25 0.75 re fw ( ) Tjrbara.uebe@[EMAIL PROTECTED]
) Tjrite.de/) Tj)
Tjanke Kinder, CVK) Tjj
Use of uninitialized value in length at
/usr/lib/perl5/site_perl/5.8.5/CAM/PDF.pm line 3600.
Argument "BT\r70.5 49.5  TD\r0 0 0 rg \r/F0 9.75  Tf\r-0.2025  Tc ..."
isn't
numeric in numeric lt (<) at /usr/lib/perl5/site_perl/5.8.5/CAM/PDF.pm
line
2060.
--snap--

With PDF::API2 I manage to get a PDF::API2::Content::Text object
-> just that I cant find out what to do with it. How the heck do I find
out
whether there are emails to be masked in that obj?

Does anybody
 - know where to find do***entation an a PDF::API2::Content::Text obj?
 - know why ma CAM::PDF call end in an endless loop
 - have any other idea how to replace certain strings in a pdf?
 - know a docu on how pdf works - which I obviously dont know...


Thanks a lot in advance,
Wolf
 




 1 Posts in Topic:
edit pdf
wolf.blaum@[EMAIL PROTECT  2008-04-04 02:54:59 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 10:09:50 CDT 2008.