I used the form process as it seemed to be the most compact way of doing it :). and my java is horrific :P . Final format was as such:
</form> {% for pdf_store in display_pdf_store %} <tr onclick='highlight()'> <form action='/download_pdf' method='POST'> <td> {{ pdf_store.product_serial_number}} <input type="hidden" name="product_serial_number" value="{{ pdf_store.product_serial_number}}" /> </td> <td> {{ pdf_store.doctype}} <input type="hidden" name="doctype" value="{{ pdf_store.doctype}}" /> </td> <td> {{ pdf_store.date_time}} <input type="hidden" name="date_time" value="" /> </td> <td> {{ pdf_store.place_of_procedure}} <input type="hidden" name="place_of_procedure" value="{{ pdf_store.place_of_procedure}}" /></td> <td><input type='submit' id='Export' value='Export'></input></td> </form> </tr> {% endfor %}
@pdf_display_blueprint.route('/download_pdf', methods=['POST' , 'GET']) def download_pdf(): Target_SN = request.form['product_serial_number'] Target_Doc = request.form['doctype'] selected_row= pdf_store.query.filter_by(product_serial_number=Target_SN).filter_by(doctype=Target_Doc).first() file_data = BytesIO(selected_row.data) return send_file(file_data, attachment_filename= Target_SN + ' - ' + Target_Doc + '.pdf', as_attachment=True) return redirect(url_for('pdf_display.pdf_display_layout'))