Class: Thinreports::BasicReport::Generator::PDF::Document
- Inherits:
-
Object
- Object
- Thinreports::BasicReport::Generator::PDF::Document
- Includes:
- DrawShape, DrawTemplateItems, Font, Graphics, Page, ParseColor, Utils
- Defined in:
- lib/thinreports/basic_report/generator/pdf/document.rb
Constant Summary
Constants included from Page
Constants included from Graphics
Graphics::BASE_LINE_WIDTH, Graphics::STROKE_DASH
Constants included from Font
Font::BUILTIN_FONTS, Font::DEFAULT_FALLBACK_FONTS, Font::FONT_STORE, Font::PRAWN_BUINTIN_FONT_ALIASES
Instance Attribute Summary collapse
- #pdf ⇒ Prawn::Document readonly
Instance Method Summary collapse
-
#create_stamp(id, &block) ⇒ Object
Delegate to Prawn::Document#create_stamp.
-
#initialize(title: nil, security: nil) ⇒ Document
constructor
A new instance of Document.
- #internal ⇒ Object
-
#render ⇒ Object
Delegate to Prawn::Document#render.
-
#render_file(*args) ⇒ Object
Delegate to Prawn::Document#render_file.
- #stamp(stamp_id, at = nil) ⇒ Object
- #translate(x, y, &block) ⇒ Object
Methods included from Page
#add_blank_page, #max_content_height, #start_new_page, #start_new_page_for_section_report
Methods included from DrawTemplateItems
Methods included from DrawShape
#draw_shape_ellipse, #draw_shape_iblock, #draw_shape_image, #draw_shape_line, #draw_shape_pageno, #draw_shape_rect, #draw_shape_tblock, #draw_shape_text, #shape_iblock_dimenions
Methods included from Graphics
#base64image, #build_fill_styles, #build_graphic_attributes, #build_stroke_styles, #build_text_attributes, #clean_temp_images, #create_temp_imagefile, #ellipse, #font_family, #font_styles, #image, #image_box, #image_dimensions, #image_position_x, #image_position_y, #letter_spacing, #line, #line_height, #migrate_overflow_wrap_from_word_wrap, #overflow_wrap, #rect, #temp_image_registry, #text, #text_align, #text_box, #text_overflow, #text_valign, #with_graphic_styles, #word_wrap
Methods included from ParseColor
Methods included from Font
#default_family, #default_family_if_missing, #font_has_style?, #install_font, #setup_fonts
Methods included from Utils
#blank_value?, #call_block_in, #deep_copy, included
Constructor Details
#initialize(title: nil, security: nil) ⇒ Document
Returns a new instance of Document.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/thinreports/basic_report/generator/pdf/document.rb', line 29 def initialize(title: nil, security: nil) @pdf = Prawn::Document.new( skip_page_creation: true, margin: [0, 0], info: { CreationDate: Time.now, Creator: 'Thinreports Generator for Ruby ' + Thinreports::VERSION, Title: title } ) # Setup to Prawn::Document. setup_fonts setup_custom_graphic_states # Encrypts the document. @pdf.encrypt_document(security) if security end |
Instance Attribute Details
#pdf ⇒ Prawn::Document (readonly)
25 26 27 |
# File 'lib/thinreports/basic_report/generator/pdf/document.rb', line 25 def pdf @pdf end |
Instance Method Details
#create_stamp(id, &block) ⇒ Object
Delegate to Prawn::Document#create_stamp
82 83 84 |
# File 'lib/thinreports/basic_report/generator/pdf/document.rb', line 82 def create_stamp(id, &block) pdf.create_stamp(id, &block) end |
#internal ⇒ Object
87 88 89 |
# File 'lib/thinreports/basic_report/generator/pdf/document.rb', line 87 def internal @pdf end |
#render ⇒ Object
Delegate to Prawn::Document#render
49 50 51 52 53 |
# File 'lib/thinreports/basic_report/generator/pdf/document.rb', line 49 def render result = pdf.render finalize result end |
#render_file(*args) ⇒ Object
Delegate to Prawn::Document#render_file
57 58 59 60 |
# File 'lib/thinreports/basic_report/generator/pdf/document.rb', line 57 def render_file(*args) finalize pdf.render_file(*args) end |
#stamp(stamp_id, at = nil) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/thinreports/basic_report/generator/pdf/document.rb', line 71 def stamp(stamp_id, at = nil) if at.nil? pdf.stamp(stamp_id) else pdf.stamp_at(stamp_id, rpos(*at)) end end |
#translate(x, y, &block) ⇒ Object
64 65 66 67 |
# File 'lib/thinreports/basic_report/generator/pdf/document.rb', line 64 def translate(x, y, &block) x, y = rpos(x, y) pdf.translate(x, y, &block) end |