argp
unread,Sep 30, 2010, 10:51:21 AM9/30/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to origami-pdf
Hello,
I am trying to encrypt an existing PDF file with the latest
development version of origami and I am getting the following error:
./../../origami/encryption.rb:403:in `replace': can't modify frozen
string (TypeError)
from ./../../origami/encryption.rb:403:in `decrypt!'
from ./../../origami/string.rb:226:in `value'
from ./../../origami/string.rb:215:in `to_s'
from ./../../origami/dictionary.rb:104:in `to_s'
from ./../../origami/dictionary.rb:103:in `each_pair'
from ./../../origami/dictionary.rb:103:in `to_s'
from ./../../origami/pdf.rb:645:in `to_bin'
from ./../../origami/pdf.rb:582:in `each'
from ./../../origami/pdf.rb:582:in `to_bin'
from ./../../origami/pdf.rb:551:in `each'
from ./../../origami/pdf.rb:551:in `to_bin'
from ./../../origami/pdf.rb:236:in `save'
from ./../../origami/pdf.rb:253:in `saveas'
from ./enc.rb:14
The simple code I am using is the following:
begin
require 'origami'
rescue LoadError
ORIGAMIDIR = "#{File.dirname(__FILE__)}/../.."
$: << ORIGAMIDIR
require 'origami'
end
include Origami
pdf = PDF.read("orig.pdf")
pdf = pdf.encrypt("", "", :Algorithm => :AES )
pdf.saveas("new.pdf")
Am I doing something wrong or was there a bug introduced in the latest
development version? The above code snippet works fine with an older
checkout of the code tree I have.
Thanks in advanced,
Patroklos