wiki_pdf_export_lib.patch

Jun NAITOH, 2011-10-30 02:35

Download (1.52 KB)

View differences:

lib/redmine/export/pdf.rb 2011-10-30 09:01:37.276642694 +0900
444 444
        pdf.Output
445 445
      end
446 446

  
447
      # Returns a PDF string of a single wiki page
448
      def wiki_to_pdf(page, project)
449
        pdf = ITCPDF.new(current_language)
450
        pdf.SetTitle("#{project} - #{page.title}")
451
        pdf.alias_nb_pages
452
        pdf.footer_date = format_date(Date.today)
453
        pdf.AddPage
454
        pdf.SetFontStyle('B',11)
455
        pdf.RDMMultiCell(190,5,
456
             "#{project} - #{page.title} - # #{page.content.version}")
457
        pdf.Ln
458

  
459
        # Set resize image scale
460
        pdf.SetImageScale(1.6)
461

  
462
        pdf.SetFontStyle('',9)
463
        pdf.RDMwriteHTMLCell(190,5,0,0,
464
            page.content.text.to_s, page.attachments, "TLRB")
465

  
466
        if page.attachments.any?
467
          pdf.Ln
468
          pdf.SetFontStyle('B',9)
469
          pdf.RDMCell(190,5, l(:label_attachment_plural), "B")
470
          pdf.Ln
471
          for attachment in page.attachments
472
            pdf.SetFontStyle('',8)
473
            pdf.RDMCell(80,5, attachment.filename)
474
            pdf.RDMCell(20,5, number_to_human_size(attachment.filesize),0,0,"R")
475
            pdf.RDMCell(25,5, format_date(attachment.created_on),0,0,"R")
476
            pdf.RDMCell(65,5, attachment.author.name,0,0,"R")
477
            pdf.Ln
478
          end
479
        end
480

  
481
        pdf.Output
482
      end
483

  
447 484
      class RDMPdfEncoding
448 485
        include Redmine::I18n
449 486
        def self.rdm_pdf_iconv(ic, txt, toUTF8 = false)