If wkhtmltopdf throws a ContentNotFoundError exception (even though there is content) or other catchable exceptions the output keyword is not updated properly as it is in the try: section if no exception is thrown. This causes the PDF being returned to be empty, empty PdfFileWriter() created in print_format.py line 26. This causes issues like https://github.com/frappe/erpnext/issues/13124 to occur where the viewer.js throws an error due to a bad pdf file. The ContentNotFoundError exception is happening due to no header image in the letterhead or its a bad link being used when multi printing.
The whole get_pdf() function should be rebuilt to test for ContentNotFoundError and other errors from wkhtmltopdf and then use a secondary try/catch to check for any other IOErrors related to being able to read the PDF back in from the file. Right now this is not DRY since I basically copy and pasted lines 18 - 22 under line 31 so that if there is an error but the file exists the output will still be appended properly.
* Data export tool
New doctype to export data
Child table export option
Ability to add filter
* Filter view refactor
Separated filter css
* Moved exporter script from data import doctype to data export doctype
* some input validation
* removed unwanted file and some style fixes
* removed console log
* hide sidebar
* renamed export method
* added data export link in setup module page
* minor fix
* refactor exporter.py
* data export ui tweaks
* codacy and bug fix
* silly code fixes
* [minor] indentation fix
* added actions button for bulk operations
also included bulk edit option
* page html refactor and added show/hide action option
* copy field object to avoid mutation
* commonify update method and other refactor
* fixed bug with progress bar level and minor fix with 'value' field display
* fixedfrappe/erpnext#13063
* commonify field control method and removed unwanted code
* separate method for submit and cancel
* [minor] msgprint change
* refresh list on complete
* requested changes and refactor
* codacy fix
* code formatting, changed var name
* conflict fix
* description option for progress dialog
* extracted bulk operations to a separate file
* Refactor
commonified redundant method
get_json -> parse_json
* rename change_df -> replace_field
* [listview] Show freeze message
* Call refresh on same page
* Simplify query_report lifecycle, Print partially working
* PDF Print, frappe.render_pdf
* Show freeze message
* Export