encryption.rb error

32 views
Skip to first unread message

argp

unread,
Sep 30, 2010, 10:51:21 AM9/30/10
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

Guillaume Delugré

unread,
Oct 14, 2010, 8:48:04 AM10/14/10
to origami-pdf
Hello!

It looks like the problem is coming from some code I added recently.
Unfortunately I am unable to reproduce the bug here.

Can I get a copy of orig.pdf ? Is it already encrypted ?

Regards,
Guillaume

decalage

unread,
Oct 23, 2010, 5:30:44 AM10/23/10
to origami-pdf
Hi,
I have just posted a file which triggers the same issue here:
http://code.google.com/p/origami-pdf/issues/detail?id=3
Cheers,

Philippe.

argp

unread,
Oct 27, 2010, 4:35:12 AM10/27/10
to origami-pdf
On Oct 23, 12:30 pm, decalage <decal...@laposte.net> wrote:
> Hi,
> I have just posted a file which triggers the same issue here:http://code.google.com/p/origami-pdf/issues/detail?id=3

I have just tested this (on Linux) with the latest checkout of origami
and I can confirm that it replicates the issue I have reported
originally.

Regards,
Patroklos
Reply all
Reply to author
Forward
0 new messages