Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9d53ee8

Browse filesBrowse files
authored
BUG: Fix merging encrypted files (#757)
1 parent fe45d2e commit 9d53ee8
Copy full SHA for 9d53ee8

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎PyPDF2/merger.py

Copy file name to clipboardExpand all lines: PyPDF2/merger.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ def merge(self, position, fileobj, bookmark=None, pages=None, import_bookmarks=T
119119
fileobj = StreamIO(filecontent)
120120
my_file = True
121121
elif isinstance(fileobj, PdfFileReader):
122+
if hasattr(fileobj, '_decryption_key'):
123+
decryption_key = fileobj._decryption_key
122124
orig_tell = fileobj.stream.tell()
123125
fileobj.stream.seek(0)
124126
filecontent = StreamIO(fileobj.stream.read())
125127
fileobj.stream.seek(orig_tell) # reset the stream to its original location
126128
fileobj = filecontent
127-
if hasattr(fileobj, '_decryption_key'):
128-
decryption_key = fileobj._decryption_key
129129
my_file = True
130130

131131
# Create a new PdfFileReader instance using the stream

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.