Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When identifying original pdf file, skip the first output lines that … #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
width is being used in place of height (although this function actual…
…ly doesn't seem to do anything)
  • Loading branch information
BrentNoorda committed May 13, 2016
commit 1e69d5c31068173e9561a411ade93467fda23c70
8 changes: 4 additions & 4 deletions pypdfocr/pypdfocr_pdf.py
Original file line number Diff line number Diff line change
@@ -155,7 +155,7 @@ def overlay_hocr_pages(self, dpi, hocr_filenames, orig_pdf_filename):
merger.append(PdfFileReader(file(text_pdf_filename, 'rb')))
merger.write(all_text_filename)
merger.close()
del merger
del merger


writer = PdfFileWriter()
@@ -191,10 +191,10 @@ def _get_merged_single_page(self, original_page, ocr_text_page):

if orig_rotation_angle != 0:
logging.info("Original Rotation: %s" % orig_rotation_angle)
self.mergeRotateAroundPointPage(original_page, ocr_text_page, orig_rotation_angle, ocr_text_page.mediaBox.getWidth()/2, ocr_text_page.mediaBox.getWidth()/2)
self.mergeRotateAroundPointPage(original_page, ocr_text_page, orig_rotation_angle, ocr_text_page.mediaBox.getWidth()/2, ocr_text_page.mediaBox.getHeight()/2)
# None of these commands worked for me:
#orig_pg.rotateCounterClockwise(orig_rotation_angle)
#orig_pg.mergeRotatedPage(text_pg,orig_rotation_angle)
#original_page.rotateCounterClockwise(orig_rotation_angle)
#original_page.mergeRotatedPage(ocr_text_page,orig_rotation_angle)
else:
original_page.mergePage(ocr_text_page)
original_page.compressContentStreams()