@@ -51,14 +51,12 @@ def return_pdf_data(self, pdf_path = None):
5151 ## Setup output data object and load source PDF data
5252 writable_pdf_data = PdfFileWriter ()
5353 with open (pdf_path , 'rb' ) as fb :
54- # source_pdf_data = PdfFileReader(open(pdf_path, 'rb'))
5554 source_pdf_data = PdfFileReader (fb )
55+ ## Load source PDF into output object
56+ for i in range (source_pdf_data .getNumPages ()):
57+ writable_pdf_data .addPage (source_pdf_data .getPage (i ))
5658
57- ## Load source PDF into output object
58- for i in range (source_pdf_data .getNumPages ()):
59- writable_pdf_data .addPage (source_pdf_data .getPage (i ))
60-
61- if self .verbose > 0 :
59+ if self .verbose and self .verbose > 0 :
6260 notice ('finished loading data into output object from: {0}' .format (pdf_path ))
6361
6462 ## Return output object to calling process
@@ -79,7 +77,7 @@ def return_js_data(self, js_path = None):
7977 else :
8078 message = 'finished loading JavaScript data from: '
8179
82- if self .verbose > 0 :
80+ if self .verbose and self . verbose > 0 :
8381 notice (message + js_path )
8482
8583 return js_data
@@ -113,7 +111,7 @@ def save_combined_data(self, pdf_data = None, js_data = None, pdf_path = None, s
113111 error ('Unable to remove temp path: {0}' .format (tmp_path ))
114112
115113 if path_exists (save_path ) is True :
116- if self .verbose > 0 :
114+ if self .verbose and self . verbose > 0 :
117115 notice (message + save_path )
118116 return save_path
119117 else :
0 commit comments