1
0
mirror of https://github.com/kanzure/pdfparanoia.git synced 2024-12-04 23:15:52 +01:00

minor py3k-compat changes

This commit is contained in:
Bryan Bishop 2013-07-19 21:26:12 -05:00
parent 59a71a7cd3
commit 528eae7e46
2 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,7 @@ class AmericanInstituteOfPhysics(Plugin):
if hasattr(obj, "attrs"): if hasattr(obj, "attrs"):
# watermarks tend to be in FlateDecode elements # watermarks tend to be in FlateDecode elements
if obj.attrs.has_key("Filter") and str(obj.attrs["Filter"]) == "/FlateDecode": if "Filter" in obj.attrs and str(obj.attrs["Filter"]) == "/FlateDecode":
length = obj.attrs["Length"] length = obj.attrs["Length"]
# the watermark is never very long # the watermark is never very long
@ -45,7 +45,7 @@ class AmericanInstituteOfPhysics(Plugin):
data = copy(obj.get_data()) data = copy(obj.get_data())
phrase="Redistribution subject to AIP license or copyright" phrase="Redistribution subject to AIP license or copyright"
if phrase in data: if phrase in str(data):
if verbose >= 2: if verbose >= 2:
sys.stderr.write("%s: Found object %s with %r: %r; omitting..." % (cls.__name__, objid, phrase, data)) sys.stderr.write("%s: Found object %s with %r: %r; omitting..." % (cls.__name__, objid, phrase, data))
elif verbose >= 1: elif verbose >= 1:

View File

@ -33,13 +33,13 @@ class IEEEXplore(Plugin):
if hasattr(obj, "attrs"): if hasattr(obj, "attrs"):
# watermarks tend to be in FlateDecode elements # watermarks tend to be in FlateDecode elements
if obj.attrs.has_key("Filter") and str(obj.attrs["Filter"]) == "/FlateDecode": if "Filter" in obj.attrs and str(obj.attrs["Filter"]) == "/FlateDecode":
#length = obj.attrs["Length"] #length = obj.attrs["Length"]
#rawdata = copy(obj.rawdata) #rawdata = copy(obj.rawdata)
data = copy(obj.get_data()) data = copy(obj.get_data())
phrase= "Authorized licensed use limited to: " phrase= "Authorized licensed use limited to: "
if phrase in data: if phrase in str(data):
if verbose >= 2: if verbose >= 2:
sys.stderr.write("%s: Found object %s with %r: %r; omitting..." % (cls.__name__, objid, phrase, data[data.index(phrase):data.index(phrase)+1000])) sys.stderr.write("%s: Found object %s with %r: %r; omitting..." % (cls.__name__, objid, phrase, data[data.index(phrase):data.index(phrase)+1000]))
elif verbose >= 1: elif verbose >= 1: