Confluence has been updated to version 6.15.9

Page tree
Skip to end of metadata
Go to start of metadata

Introduction 

The Better PDF Explorer for Jira allows to export an issue to pdf - this faq details how to configure the add-on to export a table grid


This FAQ has been made possible by the people from Midori - the creators of the add-on.
Check the discussion on Atlassian Answers


More details on the JIRA PDF View Plugin can be found on their marketplace listing.

How to configure the add-on


The add-on is providing editable templates (Administration -> ... -> PDF Templates). 
Edit the issue-fo.vm and add following code section at the right location. 

(Note: Family List is the name of the table grid editor field)


#set ($customfieldId = "Family List")
#set ($customfield = $customFieldManager.getCustomFieldObjectByName($customfieldId))
#set ($moduleDescriptor = $customfield.getCustomFieldType().getDescriptor())
#set ($fieldLayoutItem = ${fieldLayout.getFieldLayoutItem($customfield.id)})
#set ($htmlMarkup = $moduleDescriptor.getViewHtml($customfield, "htmlMarkup", $issue, $fieldLayoutItem))
#set ($htmlMarkup = $htmlMarkup.trim())
  
## remove all <div ...> tags 
#foreach($j in [1..10])
    #set($s = $stringutils.indexOf($htmlMarkup, "<div"))
    #if($s != -1)
        #set($e = $stringutils.indexOf($htmlMarkup, ">", $s))
        #if($e != -1)
            #set($e = $e + 1)
            #set($htmlMarkup = $stringutils.remove($htmlMarkup, $stringutils.substring($htmlMarkup, $s, $e)))
        #end
    #end
#end    
## remove all </div> tags
#set($htmlMarkup = $stringutils.remove($htmlMarkup, "</div>"))
 
## remove table tag without valid rows (NB: this is a bug in Table Grid)
#set($e = $stringutils.indexOf($htmlMarkup, '_grid"></table>'))
#if($e != -1)
    #set($s = $stringutils.lastIndexOf($stringutils.substring($htmlMarkup, 0, $e), "<table"))
    #if($s != -1)
        #set($e = $e + 15)
        #set($htmlMarkup = $stringutils.remove($htmlMarkup, $stringutils.substring($htmlMarkup, $s, $e)))
    #end
#end    
 
<fo:block color="green">
    $pdfRenderer.htmlToFo($htmlMarkup)
</fo:block>


Result