0

for testing the encryption function (by default 128 bit encryption) , i created a pdf file 'apps.pdf' with password protected 'abcd' as password.

source code 1:

use PDF::Tk;
my $doc = PDF::Tk->new( pdftk => '/apps/free/pdftk/1.44/bin/pdftk' );
$doc->call_pdftk( 'apps.pdf', '1.128.pdf', 'owner_pw', 'abcd' );

getting error:

Error: Unexpected command-line data:
     owner_pw 
where we were expecting an input PDF filename, 
operation (e.g. "cat") or "input_pw". Exiting. 
Errors encountered. No output created. 
Done. Input errors, so no output created. 
pdftk apps.pdf owner_pw abcd 1.128.pdf failed: 256 at /usr/lib/perl5/site_perl/5.10.0/PDF/Tk.pm         line 73.

note: created a new pdf 'apps.pdf' with Document Open Password as 'abcd' and permission Password as 'abcd123'. Please let me know how to resolve it.

Miller
  • 34,962
  • 4
  • 39
  • 60
user142847
  • 15
  • 6

1 Answers1

0

Replace line "$doc->call_pdftk( 'apps.pdf', '1.128.pdf', 'owner_pw', 'abcd' );" with command lines system('/apps/free/pdftk/1.44/bin/pdftk', 'apps.pdf', 'output', '1.128.pdf', 'owner_pw', 'abcd', 'user_pw', 'Oct1234');

"owner_pw" contains the permission password and "user_pw" contain open document password.

Result is : 1.128.pdf is created with security passwords.

user142847
  • 15
  • 6