<commit_before>== Pdf_gen
pdf_gen is a high-level wrapper around {PDF::Writer}[https://github.com/sandal/pdf-writer] library which allows to create PDF documents in an easy way with a layout similar to HTML.

== Install
  gem install pdf_gen

== Usage
All package entities are located within the PDFGen module.
PDF file generation can be made in the following way:

  require "pdf_gen"

  PDFGen::document PDF::Writer.new, 0.cm do
    # pdf generation code here
  end.save("#{File.basename(__FILE__, ".rb")}.pdf")

== Construction Elements

=== Caption
An object which allows to represent some parts of the text in PDF file. This object has such properties as width, justification, pad_top (indent from the left side of the page), pad_bottom, pad_left, pad_right, text_color, font_size and border.
The Border, in its turn, can be characterized by border_color, border_style (solid or dotted) and border_width (in cm or pixels).
Support Properties:
  pad_top - integer
  pad_bottom - integer
  pad_left - integer
  pad_right - integer
  paddings - integer
  border - true|false
  border_top - true|false
  border_bottom - true|false
  border_left - true|false
  border_right - true|false
  border_style - :solid | :dotted
  border_widht - integer
  border_color - object of color-tools*. Color::RGB::Red|Color::RGB.from_html("#ccc")| other
  background_color - object of color-tools*. Color::RGB::Red|Color::RGB.from_html("#ccc")| other
  width - integer
  height - integer
  
  *color-tools http://ruby-pdf.rubyforge.org/color-tools/

=== Image
An object which allows to add images with filename extensions *.jpg and *.png in PDF file. This object has such properties as width, pad_top, pad_bottom, pad_left, pad_right and border.

  require "pdf_gen"

  PDFGen::document PDF::Writer.new, 2.cm do
    image_data = open(File.expand_path('ruby_logo.jpg'), "rb") { |file| file.read }
    image image_data, :width => 250
  end.save("#{File.basename(__FILE__, ".rb")}.pdf")
  
Support Properties:
  *the same as caption`s properties
  
=== Span
An object which allows setting several objects across the page. This object has such properties as width, pad_top, pad_bottom, pad_left, pad_right, border and background_color.

  PDFGen::document PDF::Writer.new, 2.cm do
    span :width => 10.cm, :pad_left => 2.cm do
      caption ' first '*50, :width => 4.cm
      caption ' second '*50, :width => 4.cm
      elements :border => true    #group set params
    end
  end.save("#{File.basename(__FILE__, ".rb")}.pdf")
  
Support Properties:
  *the same as caption`s properties
  vertical_interval - integer
  vartical_align - true | false
  
=== Div
An object which allows setting several elements in the vertical format. This object has such properties as width, horizontal_interval, pad_top, pad_bottom, pad_left, pad_right, border and background_color.

  PDFGen::document PDF::Writer.new, 2.cm do
    div :width => 10.cm do
      caption ' first '*50, :width => 4.cm
      caption ' second '*50, :width => 4.cm
      elements :border => true    #group set params
    end
  end.save("#{File.basename(__FILE__, ".rb")}.pdf")
  
Support Properties:
  *the same as caption`s properties
  horizontal_interval - integer
  horizontal_align - true | false

=== Table
An object which allows creating tables in PDF file. This object has such elements as title, header, body and footer. The columns can be made be adding “spans” inside the body of the table. The table can have borders from specific sides, for example: “:border_right => true” or “:border_right => false”.

  require "pdf_gen"

  PDFGen::document PDF::Writer.new, 0.cm do
    table do
      title do
         caption "Transactions and Triggers",
       :text_color => Color::RGB::Red, :border => true, :justification => :center, :pad_bottom => 0.25.cm
      end
      header do
        span do
          caption "Number",
                  :width => av_width / 2, :justification => :center, :border => true
          caption "Discription",
                  :width => av_width / 2, :justification => :center, :border => true
        end<commit_msg>add description for div in readme<commit_after>== Pdf_gen
pdf_gen is a high-level wrapper around {PDF::Writer}[https://github.com/sandal/pdf-writer] library which allows to create PDF documents in an easy way with a layout similar to HTML.

== Install
  gem install pdf_gen

== Usage
All package entities are located within the PDFGen module.
PDF file generation can be made in the following way:

  require "pdf_gen"

  PDFGen::document PDF::Writer.new, 0.cm do
    # pdf generation code here
  end.save("#{File.basename(__FILE__, ".rb")}.pdf")

== Construction Elements

=== Caption
An object which allows to represent some parts of the text in PDF file. 
This object has such properties as width, justification, pad_top (indent from the left side of the page), pad_bottom, pad_left, pad_right, text_color, font_size and border.
The Border, in its turn, can be characterized by border_color, border_style (solid or dotted) and border_width (in cm or pixels).
Support Properties:
  pad_top - integer
  pad_bottom - integer
  pad_left - integer
  pad_right - integer
  paddings - integer
  border - true|false
  border_top - true|false
  border_bottom - true|false
  border_left - true|false
  border_right - true|false
  border_style - :solid | :dotted
  border_widht - integer
  border_color - object of color-tools*. Color::RGB::Red|Color::RGB.from_html("#ccc")| other
  background_color - object of color-tools*. Color::RGB::Red|Color::RGB.from_html("#ccc")| other
  width - integer
  height - integer
  
  *color-tools http://ruby-pdf.rubyforge.org/color-tools/

=== Image
An object which allows to add images with filename extensions *.jpg and *.png in PDF file. 
This object has such properties as width, pad_top, pad_bottom, pad_left, pad_right and border.

  require "pdf_gen"

  PDFGen::document PDF::Writer.new, 2.cm do
    image_data = open(File.expand_path('ruby_logo.jpg'), "rb") { |file| file.read }
    image image_data, :width => 250
  end.save("#{File.basename(__FILE__, ".rb")}.pdf")
  
Support Properties:
  *the same as caption`s properties
  
=== Span
An object which allows setting several objects across the page. 
This object has such properties as width, pad_top, pad_bottom, pad_left, pad_right, border and background_color.

  PDFGen::document PDF::Writer.new, 2.cm do
    span :width => 10.cm, :pad_left => 2.cm do
      caption ' first '*50, :width => 4.cm
      caption ' second '*50, :width => 4.cm
      elements :border => true    #group set params
    end
  end.save("#{File.basename(__FILE__, ".rb")}.pdf")
  
Support Properties:
  *the same as caption`s properties
  vertical_interval - integer
  vartical_align - true | false
  
=== Div
An object which allows setting several elements in the vertical format. 
This object has such properties as width, horizontal_interval, pad_top, pad_bottom, pad_left, pad_right, border and background_color. 
Div element can be divided across pages automatically.

  PDFGen::document PDF::Writer.new, 2.cm do
    div :width => 10.cm do
      caption ' first '*50, :width => 4.cm
      caption ' second '*50, :width => 4.cm
      elements :border => true    #group set params
    end
  end.save("#{File.basename(__FILE__, ".rb")}.pdf")
  
Support Properties:
  *the same as caption`s properties
  horizontal_interval - integer
  horizontal_align - true | false

=== Table
An object which allows creating tables in PDF file. This object has such elements as title, header, body and footer. 
The columns can be made be adding “spans” inside the body of the table. 
The table can have borders from specific sides, for example: “:border_right => true” or “:border_right => false”.

  require "pdf_gen"

  PDFGen::document PDF::Writer.new, 0.cm do
    table do
      title do
         caption "Transactions and Triggers",
       :text_color => Color::RGB::Red, :border => true, :justification => :center, :pad_bottom => 0.25.cm
      end
      header do
        span do
          caption "Number",
                  :width => av_width / 2, :justification => :center, :border => true
          caption "Discription",
                  :width => av_width / 2, :justification => :center, :border => true
        end
{'fraction_non_alphanumeric': 0.1037690263348635, 'fraction_numerical': 0.00724812756704518, 'mean_word_length': 3.558920704845815, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 47, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4248524', 'n_tokens_mistral': 2510, 'n_tokens_neox': 2383, 'n_words': 912}