Fix img flip regression in PDF

PDF Input: Fix a regression that caused some images to be flipped when
converting PDF files that use image rotation operators. See #1201083
This commit is contained in:
Kovid Goyal 2013-07-14 16:10:17 +05:30
parent 34abccc4f1
commit 9ec8aac3f4

View File

@ -118,7 +118,7 @@ def flip_image(img, flip):
im.save(img)
def flip_images(raw):
for match in re.finditer(b'<IMG[^>]+/?>', raw):
for match in re.finditer(b'<IMG[^>]+/?>', raw, flags=re.I):
img = match.group()
m = re.search(br'class="(x|y|xy)flip"', img)
if m is None: continue
@ -127,7 +127,6 @@ def flip_images(raw):
if src is None: continue
img = src.group(1)
if not os.path.exists(img): continue
print ('Flipping image %s: %s'%(img, flip))
flip_image(img, flip)
raw = re.sub(br'<STYLE.+?</STYLE>\s*', b'', raw, flags=re.I|re.DOTALL)
return raw