Skip to content

Commit

Permalink
Version 3.0.2
Browse files Browse the repository at this point in the history
* Fixed a bug while handling wrong format.
  • Loading branch information
Augus1999 authored Jun 4, 2024
1 parent f6144f6 commit 6bbde08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pypdfeditor_core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

__system__ = platform.system()
__author__ = "Nianze A. TAO (Omozawa SUENO)"
__version__ = "3.0.1"
__version__ = "3.0.2"
__all__ = ["main", "reset", "remove"]


Expand Down
3 changes: 2 additions & 1 deletion pypdfeditor_core/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import time
from typing import Union, Optional, Tuple, List
from pathlib import Path
from pymupdf.mupdf import FzErrorFormat
from pymupdf import Document, Page, Pixmap, Rect, Point, Font
from pymupdf.utils import get_pixmap, set_metadata, Shape
from pymupdf import TOOLS, Matrix, Identity
Expand Down Expand Up @@ -77,7 +78,7 @@ def open_pdf(file_name: str, parent: QWidget) -> Tuple[Optional[Doc], bool]:
try: # handle wrong image formats
pdf_bites = Pixmap(file_name).tobytes()
doc = Doc("png", pdf_bites)
except RuntimeError:
except FzErrorFormat:
return _open_warning(parent)
pdf_bites = doc.convert_to_pdf() # convert to pdf
doc = Doc("pdf", pdf_bites)
Expand Down

0 comments on commit 6bbde08

Please sign in to comment.