How do I use the API's 'writer' object to write a PDF file in a SearchRequestView plugin module?

OliverS January 9, 2020

I am trying to write a plugin that exports issues from the search view to a PDF file using the SearchRequestView module.

'atlas-create-jira-plugin-module' created a class that extends AbstractSearchRequestView in which there is only one method that needs to be implemented:

public abstract void writeSearchResults(SearchRequest searchRequest,
                                        SearchRequestParams searchRequestParams,
                                        Writer writer)
                                 throws SearchException

I understand that I am supposed to use the 'writer' object to write what I want to show the user.

And for a similar plugin that exports to text/html content this works fine since 'writer' is supposed to handle strings.

For PDF files on the other hand, I would expect to need an OutputStream object to take my data.

And even if I wrap the 'writer' into a WriterOutputStream object from Apache Commons IO that lets me pass binary data, I only get empty pages in the resulting PDF since the data gets corrupted in the process. How should I go about this?

0 answers

Suggest an answer

Log in or Sign up to answer