Skip to content

Commit

Permalink
Show a message instead of force-closing on a problematic image
Browse files Browse the repository at this point in the history
  • Loading branch information
ronanpaixao committed Aug 12, 2019
1 parent 56e7012 commit 850c7ba
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pypdftk.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,9 +662,18 @@ def on_btnExtractImages_clicked(self):
fileprefix, ext = osp.splitext(filename)
rows = range(self.listPages.count())
i = 0
for item in [self.listPages.item(row) for row in rows]:
for row, item in [(row, self.listPages.item(row)) for row in rows]:
page_uuid = item.data(QtCore.Qt.UserRole)
i = pdf_images.extract_images(self.pages[page_uuid].obj, filename, i)
try:
i = pdf_images.extract_images(self.pages[page_uuid].obj, filename, i)
except:
QtWidgets.QMessageBox.critical(self, self.tr("Error"),
self.tr("There was a problem extracting images from "
"page {}.<br>Please file a bug report, "
"attaching the problematic file if possible, in <br>"
"<a href='https://github.com/ronanpaixao/PyPDFTK/issues'>"
"https://github.com/ronanpaixao/PyPDFTK/issues"
"</a>".format(row + 1)))

@QtCore.Slot()
def on_btnCredits_clicked(self):
Expand Down

0 comments on commit 850c7ba

Please sign in to comment.