Skip to content

Commit

Permalink
[PDF_EXT]: Update pypdf version to resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
amadolid committed Sep 1, 2023
1 parent e537aa9 commit 6a14bc3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions jaseci_ai_kit/jac_misc/jac_misc/pdf_ext/pdf_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import uuid

from jaseci.jsorc.live_actions import jaseci_action
from PyPDF2 import PdfFileReader
from PyPDF2 import PdfReader
from fastapi import HTTPException


Expand Down Expand Up @@ -49,14 +49,14 @@ def remove_pdf(filename: str):

def process_pdf(filename, metadata, data):
with open(filename, "rb") as pdf_file:
pdf_reader = PdfFileReader(pdf_file)
pdf_reader = PdfReader(pdf_file)
if metadata:
data.update({"metadata": {}})
md = dict(pdf_reader.documentInfo)
md = dict(pdf_reader.metadata)
for k, v in md.items():
data["metadata"][re.sub("[^a-zA-Z0-9]+", "", k)] = v
data["pages"] = len(pdf_reader.pages)
data["content"] = [page.extractText() for page in pdf_reader.pages]
data["content"] = [page.extract_text() for page in pdf_reader.pages]
return data


Expand Down
2 changes: 1 addition & 1 deletion jaseci_ai_kit/jac_misc/jac_misc/pdf_ext/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PyPDF2>=1.27.12,<1.28
pypdf==3.15.4

0 comments on commit 6a14bc3

Please sign in to comment.