Company logo in redmine PDF

How to add header logo in pdf while exporting issue

Warning: This recipe is modifying Redmine's core files, it is not a proper way to achieve desired result. The proper way to do this would be by creating your own plugin which would export issue to PDF. Because when you update Redmine, you will loose this functionality. However, updating via svn update would probably keep this change, and this functionality is not likely to be changed much in future.

To add company logo, simply edit the following file:

find two lines (usually around line number 33) that looks like this:

buf = "#{issue.project} - #{issue.tracker} ##{}"
pdf.RDMMultiCell(190, 5, buf)

and replace it with following lines:

buf = "\n   #{issue.project} - #{issue.tracker} ##{}"
image_file = Rails.root.to_s + '/public/logo.png'
pdf.Image(image_file, 10, 10, 52, '', 'PNG', '', 'T', false, 300, '', false, false, 0, false, false, false)
pdf.RDMMultiCell(210, 10, buf)

Upload your logo.png file to public folder of your redmine installation root

Once completed, navigate to any issue (bug, feature, task...) and click PDF button at the bottom

if you liked this recipe, you can find more than 80 recipes in the real book
Buy te book now on Packt's website