Project

General

Profile

PDF export doesn't display all desired fields of project issue

Added by Ash Miller over 7 years ago

Pardon my ignorance, as I am new to Redmine and Ruby. I'm trying to get the fields within my Issue-title to display on the PDF export to the issue.

The title, produced by the code within my header tags on the "show.html.erb" file, produces the Client name/Job/Job Number/Issue Number here:
(See screenshot 1 for visual output)

<h2>
    <% if @project.description.present? %>
    <% end %>
    <% if @project.homepage.present? || @project.visible_custom_field_values.any?(&:present?) %>
    <% unless @project.homepage.blank? %>
      <%= link_to_if uri_with_safe_scheme?(@project.homepage), @project.homepage, @project.homepage %>
    <% end %>
    <% render_custom_field_values(@project) do |custom_field, formatted| %>
      <%= formatted %> |
    <% end %>
    <%= issue_heading(@issue) %>
    <% end %>
</h2>

A snippet of the PDF export code from "issues_pdf_helper.rb":
(See screenshot 2 for visual output)

module Redmine
  module Export
    module PDF
      module IssuesPdfHelper
        # Returns a PDF string of a single issue
        def issue_to_pdf(issue, assoc={})
          pdf = ITCPDF.new(current_language)
          pdf.set_title("#{issue.project} | #{issue.tracker} ##{issue.id}")
          pdf.alias_nb_pages
          pdf.footer_date = format_date(User.current.today)
          pdf.add_page
          pdf.SetFontStyle('B',11)
          buf = "#{issue.project} | #{issue.tracker} ##{issue.id}"           (<----------producing the title in the PDF export.)


Basically, I need the exported PDF to display the Client name/Job/Job Number/Issue Number in the header, but I'm only getting the project name (issue.project) and the bug number (issue.tracker/issue.id). Almost everything I've tried has broken the ability to export a working PDF.

Thank you!

2.png (41.6 KB) 2.png
1.png (62.1 KB) 1.png