2011-09-16 35 views
2

我有一個使用Prawn生成PDF文檔的Rails 3應用程序。在蝦中沒有make_table方法::文檔

在Gemfile中我有:

寶石 「蝦」, '= 0.12.0'

寶石 '對蝦佈局'

然而,以下在https://github.com/sandal/prawn/blob/master/examples/table/bill.rb的例子,我正在嘗試使用Prawn :: Document類的make_table方法創建一個表。當我自己運行示例時,此工作正常,但在我的Rails環境中運行等效代碼時無法正常工作。

以下是Rails控制檯中最簡單版本的問題。 make_table方法不在Document對象中。

任何人有任何提示?

謝謝!

紅寶石1.9.2-P136:005> A =蝦:: Document.new =>

@ internal_state =#1 0 R, 2 => 2 0 R,3 = > 3 0 R,4 => 4 0 R,5 => 5 0 R},@標識符= [1,2,3,4,5], @ info = 1,@ root = 2>,@ version = 1.3, @page = [#, @margins = {:left => 36,:right => 36,:top => 36,:bottom => 36}, @ stack =#nil, :space = > nil,:phase => 0},@ cap_style =:butt,@ join_style =:miter, @ line_width = 1>]>,@ size =「LETTER」,@ layout =:portrait,@ content = 4, @ dictionary = 5,@ stamp_stream = nil,@ stamp_dictionary = nil>], @ page =#, @margins = {:left => 36,:right => 36,:top => 36,:bottom = > 36}, @ stack =#nil, :space => nil,:phase => 0},@ cap_style =:butt,@ join_style =:miter, @ line_width = 1>]>,@ size =「 LETTER「,@ layout =:portrait,@ content = 4, @ dictionary = 5,@ stamp_stream = nil,@ stamp_dictionary = nil,@ trailer = {}, @ compress = false,@ encrypt = false,@encryption_key =零, @ optimize_objects =假,@ skip_encoding =假, @ before_render_callbacks = [],@ on_page_create_callback =零>, @背景=零,@ FONT_SIZE = 12, @ bounding_box =#,@父=零,@ x = 36, @ y = 756.0,@ height = 720.0,@ width = 540.0,@t otal_left_padding = 0, @ total_right_padding = 0,@ stretched_height = nil, @ margin_box =#,@ parent = nil,@ x = 36, @ y = 756.0,@ height = 720.0,@ width = 540.0,@total_left_padding = 0,@ total_right_padding = 0,@ stretched_height =零>,@ PAGE_NUMBER = 1, @ Y = 756.0>

紅寶石1.9.2-P136:006> a.methods => [:bounding_box,: canvas, :column_box,:span,:margin_box,:margin_box =,:margin,y, :font_size =,:page_number,:page_number =,:state,:page, :start_new_page,:page_count,:go_to_page, :y =,:cursor, :move_cursor_to,:float,:render,:render_file,:bounds, :reference_bounds,:bound s:,:move_up,:move_down,:pad_top, :pad_bottom,:pad,:indent,:mask,:group,:number_pages, :page_match?,:compression_enabled?,::font,:font_size,:set_font, :save_font,:find_font,:font_registry,:font_families,:width_of, :rep​​eater,:repeat,:outline,:cell,:table,:lazy_bounding_box, :padded_box,: define_grid,:grid,:stamp,:stamp_at,:create_stamp, :image,:move_to,:line_to,:curve_to,:rectangle,:rounded_rectangle, :line_width =,:line_width,:line,:horizo​​ntal_line,:horizo​​ntal_rule, :vertical_line,:曲線,:circle_at,:圓形,:ellipse_at,:橢圓形, :多邊形,:rounded_polygon,:rounded_vertex,:中風, :close_and_stroke,:stroke_bounds,:填充:fill_and_stroke, :close_path,: method_missing,:fill_gradient,:stroke_gradient, :rotate,:translate,:scale,:transformation_matrix,:transp :stroke_color,:stroke_color =, :join_style,:join_style =,:cap_style,:cap_style =,:dash, :text_box,:文本,:格式化文本, :draw_text,:height_of,:height_of_formatted,:formatted_text_box, :skip_encoding,:draw_text!:process_text_options,:default_kerning ?, :default_kerning,:default_kerning =,:default_leading, : default_leading =,:text_direction,:text_direction =,:fallback_fonts, :fallback_fonts =,:text_rendering_mode,:character_spacing, :word_spacing,:encrypt_document,:open_graphics_state, :close_graphics_state,:save_graphics_state,:restore_graphics_state, :graphic_stack,:graphic_state,:回滾:交易:dests, :add_dest,:dest_xyz,:dest_fit,:dest_fit_horizo​​ntally, :dest_fit_vertically,:dest_fit_rect,:dest_fit_bounds, :dest_fit_bounds_horizo​​ntally,:dest_fit_bounds_vertically,:註釋, :text_annotation,:link_annotation,:ref,:ref !,:deref,:add_content, :names,:names ?,:before_render,:on_page_create,:taguri =,:taguri, :to_yaml_style,:to_yaml_properties,:syck_to_yaml, :to_yaml,:blank ?, :present ?,:presence,:acts_like ?,:try,:html_safe ?,:duplicable ?, :`,:returns,:to_param,:to_query,:instance_values, :instance_variable_names, :copy_instance_variables_from,:to_json, :with_options,:as_js上,:dclone,:撬,:結合, :instance_eval_with_params,:is_a,:元類,:to_matcher, :mocha_inspect,:摩卡,:reset_mocha,:stubba_method,:stubba_object, :預計, :存根,:unstub,:method_exists ?,:pretty_print, :pretty_print_cycle,:pretty_print_instance_variables, :pretty_print_inspect,:to_mongo,:require_or_load, :require_dependency,:require_association,:load_dependency,:負載, :需要,:卸, :nil?,:===,:=〜,:!〜,:eql ?,:hash,:< =>, :class,:singleton_class,:clone,:dup,:initialize_dup, :initialize_clone,:taint,:tainted ?,:untaint,:untrust,:untrusted ?, :trust,:freeze,:frozen ?,:to_s,:inspect,:methods, :singleton_methods,:protected_methods,:private_methods , :public_methods,:instance_variables,:instance_variable_get, :instance_variable_set,:instance_variable_defined?:instance_of? :kind_of?:is_a ?,:自來水,:發送:public_send,:的respond_to? :respond_to_missing?,:延伸:顯示器,:方法,:public_method, :define_singleton_method,:ID,:的object_id,:to_enum,:enum_for, :寶石,:silence_warnings,:enable_warnings,:with_warnings, :silence_stderr,:silence_stream ,:壓制,:class_eval, :require_library_or_gem,:調試器:斷點:pretty_inspect, :suppress_warnings,:==:等於?!,!=,:instance_eval的, :instance_exec,:發送 ]

回答

2

您的Gemfile中不需要gem 'prawn-layout'

注::對蝦佈局已合併到主對蝦庫爲2010.02.25(http://github.com/sandal/prawn),但是穩定prawn-的分支從https://github.com/sandal/prawn-layout報價佈局0.8.x仍然在這裏託管。

只需從您的Gemfile中刪除prawn-layout,然後重試。

>> pdf = Prawn::Document.new 
    pdf.methods.grep /table/ 
    => [:table, :make_table] 
相關問題