PDF::Writer crashes


#1

Hey,

I have put my site online and sometimes the site crashes when I want to
create a
pdf file. But when I reboot the server it works again.

It crashes on:
margin = PDF::Writer.cm2pts(1)
Or
pdf = PDF::Writer.prepress(:paper => “A4”, :orientation => :landscape,
:left_margin => margin, :right_margin => margin, :top_margin => 0,
:bottom_margin => 0)

Most of the time it is after the process:

I have a page with a list of users, I display the info from the database
(tables
users and clients) like for the clientname => Clientname: <%=
user.client.name %>

But in the early stages of the site some users didnt have clients, so I
got an
nil error on the page. After that i wanted to create a pdf (total
different
section on the site), and get the errors.

Anyone has any problem with this also?? And can help me??

Thanks in advance.
Nick


#2

On 12/5/05, Brutyn N. removed_email_address@domain.invalid wrote:

I have put my site online and sometimes the site crashes when I want to create a
pdf file. But when I reboot the server it works again.

Can you post the backtrace that you get?

-austin

Austin Z. * removed_email_address@domain.invalid
* Alternate: removed_email_address@domain.invalid


#3

the wierd thing is it works sometimes sometimes not when i got an error

NoMethodError in Geotags#print_tag
undefined method `cm2pts’ for PDF::Writer:Class

#{RAILS_ROOT}/app/controllers/geotags_controller.rb:354:in print_tag' /usr/local/lib/ruby/gems/1.8/gems/actionpack- 1.11.0/lib/action_controller/base.rb:841:insend’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-
1.11.0/lib/action_controller/base.rb:841:in
perform_action_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack- 1.11.0/lib/action_controller/filters.rb:332:inperform_action_without_benchmark’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-
1.11.0/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' /usr/local/lib/ruby/gems/1.8/gems/actionpack- 1.11.0/lib/action_controller/benchmarking.rb:69:inmeasure’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-
1.11.0/lib/action_controller/benchmarking.rb:69:in
perform_action_without_rescue' /usr/local/lib/ruby/gems/1.8/gems/actionpack- 1.11.0/lib/action_controller/rescue.rb:82:inperform_action’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-
1.11.0/lib/action_controller/base.rb:365:in send' /usr/local/lib/ruby/gems/1.8/gems/actionpack- 1.11.0/lib/action_controller/base.rb:365:inprocess_without_session_management_support’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-
1.11.0/lib/action_controller/session_management.rb:116:in process' /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/dispatcher.rb:38:indispatch’
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/fcgi_handler.rb:141:in
process_request' /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/fcgi_handler.rb:53:inprocess!’
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/fcgi_handler.rb:52:in
each_cgi' /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:ineach’
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:in
each_cgi' /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/fcgi_handler.rb:52:inprocess!’
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/fcgi_handler.rb:22:in
`process!’
dispatch.fcgi:24


#4

On 12/5/05, Brutyn N. removed_email_address@domain.invalid wrote:

the wierd thing is it works sometimes sometimes not when i got an error

NoMethodError in Geotags#print_tag
undefined method `cm2pts’ for PDF::Writer:Class

This is quite weird, as it seems that something is not loading
PDF::Writer (one of the instances, perhaps?) or is undefining parts of
it.

-austin

Austin Z. * removed_email_address@domain.invalid
* Alternate: removed_email_address@domain.invalid


#5

Hi !

2005/12/5, Austin Z. removed_email_address@domain.invalid:

On 12/5/05, Brutyn N. removed_email_address@domain.invalid wrote:

the wierd thing is it works sometimes sometimes not when i got an error

NoMethodError in Geotags#print_tag
undefined method `cm2pts’ for PDF::Writer:Class

One thing I found is that PDF::Writer and ActiveRecord require
different versions of Transaction::Simple.

If you’re running on Rails Edge, remove the simple.rb file from
active_record/lib/vendor. Then, get Transaction::Simple 1.3.0, unpack
into vendor, move lib/* to vendor/, and finally, require
Transaction::Simple before PDF::Writer and ActiveRecord in
config/environment.rb

Not a simple workaround, but the best I found. Now, I have everything
working.

If this is of some help to you, please say so. I’ll write an article
for my blog about this.

Bye !