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

fix: pdf first page tailor #1116

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions modules/pdf_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_title_with_cropped_page(first_page):
elif word.text == "Abstract": # 获取页面abstract
top = word.top

user_info = [i["text"] for i in extract_words(first_page.within_bbox((x0,title_bottom,x1,top)))]
user_info = [i["text"] for i in extract_words(first_page.within_bbox((x0,title_bottom,x1,bottom)))]
# 裁剪掉上半部分, within_bbox: full_included; crop: partial_included
return title, user_info, first_page.within_bbox((x0,top,x1,bottom))

Expand Down Expand Up @@ -150,4 +150,5 @@ def parse_pdf(filename, two_column = True):
# Test code
z = parse_pdf("./build/test.pdf")
print(z["user_info"])
print(z["title"])
print(z["title"])