2011-09-16 5 views
2

Prawn을 사용하여 PDF 문서를 생성하는 Rails 3 앱이 있습니다. Gemfile에 Prawn :: Document에 make_table 메서드가 없습니다.

내가 가진 :

보석 '새우', '= 0.12.0'

보석 https://github.com/sandal/prawn/blob/master/examples/table/bill.rb의 예 다음 '새우 레이아웃'그러나

, , 나는 Prawn :: Document 클래스의 make_table 메서드를 사용하여 테이블을 만들려고합니다. 이 예제는 독자적으로 실행할 때 잘 작동하지만 레일스 환경에서 동일한 코드를 실행할 때는 작동하지 않습니다.

다음은 레일스 콘솔에서 가장 간단한 버전의 문제입니다. make_table 메서드는 Document 개체에 없습니다.

누구든지 어떤 힌트가 있습니까?

감사합니다.

루비 1.9.2-P136 : 005> A = 새우 Document.new :: =>

internal_state @ # 1 = 0 R, = 2> 0 2 R 3 = @ 식별자 = [1, 2, 3, 4, 5], @ info = 1, @ root = 2>, @ version = 3 0 R, 4 => 4 0 R, 1.3, @pages = [#, @ margin = {: left => 36, : right => 36, : top => 36, bottom => 36}, @ stack = # nil, : space = > 무 : 위상 => 0} @의 cap_style = 엉덩이 @ join_style = 마이, @ line_width = 1>]> @ 크기 = "문자"@ 레이아웃 = 초상화 @ 함량 = 4,369 @ margin = = 36 : : right => 36, : top => 36, : bottom [email protected] dictionary = 5, @ stamp_stream = nil, @ stamp_dictionary = nil>], @ 페이지 = #, @ }, @ ​​size = "36", @ stack = # nil, : space => nil, : phase => 0}, @ cap_style = : 버트, @ join_style = : 마이 터, @ line_width = @ 예 : 5, @ stamp_stream = nil, @ stamp_dictionary = nil>, @ 예고편 = {}, @ 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 : 캔버스, : column_box, : span, : margin_box, : margin_box =, : 여백, : y, : font_size =, : page_number =, : 상태, : 페이지, : start_new_page, : page_count, : go_to_page, : y =, : 커서, : move_cursor_to, : float, : render, : render_file, : 경계, : reference_bounds, : bound S 개의 = : move_up : move_down : pad_top, : pad_bottom : 패드 : 오목 : 마스크 : 그룹 : number_pages는 : page_match는? : compression_enabled?, 반복 : 개요 : : 셀 : 테이블 : lazy_bounding_box, : padded_box : : font_size, : set_font, : save_font, find_font, font_registry, : font_families, : width_of, :: line_width =, : line_width, : line, : horizontal_rule, : horizontal_rule, : horizontal_line, horizontal_line, : horizontal_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, : 회전, : 변환, : 비율, : transformation_matrix, : transp do_hash =, : 대시, : 대시 =, : : 휴지통, : write_stroke_dash, : fill_color, : fill_color =, : 스트로크 _ 색상, : 스트로크 _ 색상 _, _ : text_box, 텍스트, : formatted_text, : 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_horizontally, : dest_fit_vertically : dest_fit_rect : dest_fit_bounds, : dest_fit_bounds_horizontally : dest_fit_bounds_vertically : 주석, : tag_annotation, : link_annotation, : ref, : ref !, : deref, : add_content, : 이름, : before_render, : on_page_create, : taguri =, : taguri, : to_yaml_style : to_yaml, : blank ?, : present ?, : 존재, : acts_like ?, : 시도해 : html_safe ?, : duplicable ?, :`, : 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 ?, : 해시, : < =>, : 클래스, : singleton_class, : 복제본 : dup, : initialize_dup, : initialize_clone, : taint, : 오염 된 ?, : untaint, : untrust, : untrusted, : 트러스트, : 고정, : 고정?, : tos, : 검사, : 방법, : 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'이 필요하지 않습니다.

참고 : prawn-의 새우 레이아웃이 2010년 2월 25일의로 메인 새우 저장소로 통합되었습니다 (http://github.com/sandal/prawn), 그러나 안정적인 지점 https://github.com/sandal/prawn-layout에서 인용 레이아웃 0.8.x는 여전히 여기서 호스팅됩니다.

Gemfile에서 prawn-layout을 제거하고 다시 시도하십시오.

>> pdf = Prawn::Document.new 
    pdf.methods.grep /table/ 
    => [:table, :make_table] 
관련 문제