##// END OF EJS Templates
pdf: lib: add a method to export wiki (#401)...
Toshi MARUYAMA -
r7620:1713432ab009
parent child
Show More
@@ -410,6 +410,40 module Redmine
410 pdf.Output
410 pdf.Output
411 end
411 end
412
412
413 # Returns a PDF string of a single wiki page
414 def wiki_to_pdf(page, project)
415 pdf = ITCPDF.new(current_language)
416 pdf.SetTitle("#{project} - #{page.title}")
417 pdf.alias_nb_pages
418 pdf.footer_date = format_date(Date.today)
419 pdf.AddPage
420 pdf.SetFontStyle('B',11)
421 pdf.RDMMultiCell(190,5,
422 "#{project} - #{page.title} - # #{page.content.version}")
423 pdf.Ln
424 # Set resize image scale
425 pdf.SetImageScale(1.6)
426 pdf.SetFontStyle('',9)
427 pdf.RDMwriteHTMLCell(190,5,0,0,
428 Redmine::WikiFormatting.to_html(
429 Setting.text_formatting, page.content.text.to_s), "TLRB")
430 if page.attachments.any?
431 pdf.Ln
432 pdf.SetFontStyle('B',9)
433 pdf.RDMCell(190,5, l(:label_attachment_plural), "B")
434 pdf.Ln
435 for attachment in page.attachments
436 pdf.SetFontStyle('',8)
437 pdf.RDMCell(80,5, attachment.filename)
438 pdf.RDMCell(20,5, number_to_human_size(attachment.filesize),0,0,"R")
439 pdf.RDMCell(25,5, format_date(attachment.created_on),0,0,"R")
440 pdf.RDMCell(65,5, attachment.author.name,0,0,"R")
441 pdf.Ln
442 end
443 end
444 pdf.Output
445 end
446
413 class RDMPdfEncoding
447 class RDMPdfEncoding
414 include Redmine::I18n
448 include Redmine::I18n
415 def self.rdm_pdf_iconv(ic, txt)
449 def self.rdm_pdf_iconv(ic, txt)
General Comments 0
You need to be logged in to leave comments. Login now