Forum: Ruby on Rails PDF::Writer crashes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
334ae822566107a2ea2b7a7cb88bd1d6?d=identicon&s=25 brutyn_nick (Guest)
on 2005-12-05 12:05
(Received via mailing list)
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
31ab75f7ddda241830659630746cdd3a?d=identicon&s=25 halostatue (Guest)
on 2005-12-05 17:57
(Received via mailing list)
On 12/5/05, Brutyn Nick <brutyn_nick@hotmail.com> 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 Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca
334ae822566107a2ea2b7a7cb88bd1d6?d=identicon&s=25 brutyn_nick (Guest)
on 2005-12-05 19:24
(Received via mailing list)
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:in `send'
/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:in
`perform_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:in `measure'
/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:in `perform_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:in
`process_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:in
`dispatch'
/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:in
`process!'
/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:in `each'
/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:in
`process!'
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/fcgi_handler.rb:22:in
`process!'
dispatch.fcgi:24
31ab75f7ddda241830659630746cdd3a?d=identicon&s=25 halostatue (Guest)
on 2005-12-05 20:29
(Received via mailing list)
On 12/5/05, Brutyn Nick <brutyn_nick@hotmail.com> 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 Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca
3dd4b52a0946bd698b1d1635a46ea3a3?d=identicon&s=25 francois.beausoleil (Guest)
on 2005-12-05 20:54
(Received via mailing list)
Hi !

2005/12/5, Austin Ziegler <halostatue@gmail.com>:
> On 12/5/05, Brutyn Nick <brutyn_nick@hotmail.com> 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 !
This topic is locked and can not be replied to.