From b832a5941458083dd6147efb652036552f95b786 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 12 Oct 2018 11:49:24 +0200 Subject: Refactor lightweight mode implementation --- libmat2/pdf.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libmat2/pdf.py') diff --git a/libmat2/pdf.py b/libmat2/pdf.py index c8769aa..140b4f4 100644 --- a/libmat2/pdf.py +++ b/libmat2/pdf.py @@ -37,7 +37,12 @@ class PDFParser(abstract.AbstractParser): except GLib.GError: # Invalid PDF raise ValueError - def remove_all_lightweight(self): + def remove_all(self) -> bool: + if self.lightweight_cleaning is True: + return self.__remove_all_lightweight() + return self.__remove_all_thorough() + + def __remove_all_lightweight(self) -> bool: """ Load the document into Poppler, render pages on a new PDFSurface. """ @@ -64,7 +69,7 @@ class PDFParser(abstract.AbstractParser): return True - def remove_all(self): + def __remove_all_thorough(self) -> bool: """ Load the document into Poppler, render pages on PNG, and shove those PNG into a new PDF. -- cgit v1.3