Export Issues - Print Details
Asked by Fetu Ah Young:

I want to export multiple issues with attachments (photos as attachments) by using the Print details option under Export Issues.

This way we can see all the issues with images embedded in.

I couldn't get this working, it shows images as a text file but no image.

The work around is to put images in description but we have over 1000 issues

Had a look at Better PDF Exporter but only can do single pdf but also doesn't work sometimes displaying images.

Any help or suggestion will be much appreciated.


Answers:
author: Mikel Garcia Bartolome
body: Exporting issues from Jira Cloud with embedded images can be challenging, especially when you want to do this for multiple issues at once. Here are a few potential solutions to achieve this goal:

#### **Using "Better PDF Exporter for Jira Cloud"** {#toc-hId-348768366}

Since you have mentioned trying the "Better PDF Exporter" plugin but faced issues, ensure you are following the correct steps and check if there are any updates or support from the plugin developers.

#### Utilizing Custom Scripts {#toc-hId--1458686097}

If you have programming skills or can engage a developer, using the Jira REST API along with a script to export the issues and their attachments into a document format (like PDF) could be a viable solution. This approach gives you complete control over how the data and images are presented.

Here's a simplified version of how you can achieve this:

* **Fetch issues from Jira**

Use the Jira REST API to fetch issues with their attachments. You can use a script written in Python for this purpose.

* **Create a script to generate a PDF**

Use a library like \`fpdf\` or \`reportlab\` in Python to create a PDF with embedded images.

**Example Python Script**

1. Fetching issues with attachments

```
import requests
from requests.auth import HTTPBasicAuth
import json

# Jira API endpoint
JIRA_URL = "https://your-domain.atlassian.net/rest/api/3/search"

# Authentication
auth = HTTPBasicAuth("your-email@example.com", "your-api-token")

# JQL query to fetch issues
query = {
'jql': 'project = "YOUR_PROJECT_KEY"',
'fields': ['summary', 'description', 'attachment'],
'maxResults': 1000 # Adjust as necessary
}

# Request issues
response = requests.post(JIRA_URL, auth=auth, headers={"Content-Type": "application/json"}, data=json.dumps(query))
issues = response.json()['issues']

# Download attachments
for issue in issues:
for attachment in issue['fields']['attachment']:
attachment_url = attachment['content']
attachment_response = requests.get(attachment_url, auth=auth)
with open(f"attachments/{attachment['filename']}", "wb") as file:
file.write(attachment_response.content)

```

2. Generating a PDF with embedded images:\*\*  

```
from fpdf import FPDF

class PDF(FPDF):
def header(self):
self.set_font('Arial', 'B', 12)
self.cell(0, 10, 'Jira Issues Report', 0, 1, 'C')

def issue(self, summary, description, attachments):
self.set_font('Arial', '', 12)
self.cell(0, 10, f'Summary: {summary}', 0, 1)
self.multi_cell(0, 10, f'Description: {description}')
for attachment in attachments:
self.image(f'attachments/{attachment}', w=100)
self.ln(10)

# Create a PDF instance
pdf = PDF()

# Add a page
pdf.add_page()

# Add issues to PDF
for issue in issues:
summary = issue['fields']['summary']
description = issue['fields']['description']
attachments = [att['filename'] for att in issue['fields']['attachment']]
pdf.issue(summary, description, attachments)

# Output the PDF to a file
pdf.output('jira_issues_report.pdf')
```

**Using Third-Party Tools**

There are other third-party tools available which might offer the functionality you need:

* Jira PDF View Plugin
* Jira Cloud for Excel

These tools sometimes offer better support for handling attachments and might provide more reliable results than the built-in export options.

<br />

While the process can be complex, using the Jira REST API with a custom script gives you the flexibility to export issues and their attachments in the desired format. If scripting isn't an option, exploring third-party tools and plugins might provide a solution.


author: Aron Gombas _Midori_
body: [@Fetu Ah Young](/t5/user/viewprofilepage/user-id/5473648) I am a developed working on the [Better PDF Exporter](https://marketplace.atlassian.com/apps/5167/better-pdf-exporter-for-jira?hosting=cloud&tab=overview) app.

It is not clear what do you mean by these?

* "only can do single pdf"
* "doesn't work sometimes displaying images"

comments: author: Fetu Ah Young
body: Hi,

Thanks for the reply. Have found that i can export bulk issues to pdf only if you have a saved filter.

I couldn't see this option when opening the Issues tab.

It is sorted now.

Thanks


Tags: cloud

jira-cloud