54065add4551a2415af574ad558f7c2d6fbeb9a9,pdftotree/TreeVisualizer.py,,get_pdf_dim,#Any#,86
Before Change
)
soup = BeautifulSoup(html_content, "html.parser")
pages = soup.find_all("page")
page_width, page_height = (
int(float(pages[0].get("width"))),
int(float(pages[0].get("height"))),
)
return page_width, page_height
After Change
def get_pdf_dim(pdf_file) -> Tuple[int, int]:
with open(pdf_file, "rb") as f:
parser = PDFParser(f)
doc = PDFDocument(parser)
// Look at the 1st page only.
page = next(PDFPage.create_pages(doc))
_, _, page_width, page_height = page.mediabox
return page_width, page_height
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: HazyResearch/pdftotree
Commit Name: 54065add4551a2415af574ad558f7c2d6fbeb9a9
Time: 2020-09-24
Author: hiromu.hota@hal.hitachi.com
File Name: pdftotree/TreeVisualizer.py
Class Name:
Method Name: get_pdf_dim
Project Name: regel/loudml
Commit Name: d1cc461c74c8c4b1e937583ca9adc1400c69a3f9
Time: 2018-08-27
Author: christophe@redmintnetwork.fr
File Name: loudml/loudml/license.py
Class Name: License
Method Name: load
Project Name: EducationalTestingService/skll
Commit Name: ca10c185d94470054d693f19e7691523dbe3ec55
Time: 2019-03-05
Author: jbiggs@ets.org
File Name: skll/data/readers.py
Class Name: NDJReader
Method Name: _sub_read