jpg2pdf.rb
# generate pdf from sorted images array
generate pdf from sorted images array
generate pdf from sorted images array
def generate_pdf(images,
                   text_location,
                   sizes,
                   year: @infos[YEAR],
                   name: @infos[STUDENT],
                   lesson: @infos[LESSON],
                   prop: @infos[PROP],
                   exam_type: @infos[EXAM])
    @log.info 'Pdf generate start...'
    begin
      Prawn::Document.generate(@pdf_name, page_size: sizes, margin: 0) do
        bounding_box([0, text_location], width: bounds.width, height: bounds.height) do
          text lesson, align: :center, size: 300
          move_down 50
          text year, align: :center, size: 250
          move_down 50
          text exam_type, align: :center, size: 200
          move_down 50
          text prop, align: :center, size: 200
          move_down 70
          text name, align: :center, size: 250
        end
        images.each do |img|
          start_new_page
          image img, at: [0, sizes.last]
        end
      end
      @log.info 'Pdf generation finish with success!'
      true
    rescue StandardError
      @log.error 'Pdf generation fault!'
      false
    end
  end
def generate_pdf ( images , text_location , sizes , year : @infos [ YEAR ] , name : @infos [ STUDENT ] , lesson : @infos [ LESSON ] , prop : @infos [ PROP ] , exam_type : @infos [ EXAM ] ) @log . info 'Pdf generate start...' begin Prawn :: Document . generate ( @pdf_name , page_size : sizes , margin : 0 ) do bounding_box ( [ 0 , text_location ] , width : bounds . width , height : bounds . height ) do text lesson , align : :center , size : 300 move_down 50 text year , align : :center , size : 250 move_down 50 text exam_type , align : :center , size : 200 move_down 50 text prop , align : :center , size : 200 move_down 70 text name , align : :center , size : 250 end images . each do | img | start_new_page image img , at : [ 0 , sizes . last ] end end @log . info 'Pdf generation finish with success!' true rescue StandardError @log . error 'Pdf generation fault!' false end end
generate pdf from sorted images array
generate pdf from sorted images array
# TODO: omu dökümantasyon ilk sayfaya resim şeklinde eklenecek # TODO: unicode desteği ekle
images
<not_specific>
text_location
<not_specific>
sizes
<not_specific>
year
<not_specific>
name
<not_specific>
lesson
<not_specific>
prop
<not_specific>
exam_type
<not_specific>