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

reverting to ab60cbe #1753

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Changes from all commits
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
21 changes: 7 additions & 14 deletions src/backend/expungeservice/form_filling.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def __init__(self, path: str):
self.writer = PdfWriter()
try:
print(stat(path))
self._pdf = PdfReader()
self._pdf = PdfReader(path)
print("file opened by reader")
except Exception as e:
with open(path, 'wb') as f:
Expand Down Expand Up @@ -728,20 +728,13 @@ def _create_pdf(source_data: UserInfo, validate_initial_pdf_state=False) -> PDF:

@staticmethod
def _create_and_write_summary_pdf(file_name: str, markdown: bytes, temp_dir: str):
# TODO: remove file_name, temp_dir arguments,
# source_dir = path.join(Path(__file__).parent, "files")
# pdf_path = path.join(source_dir, file_name)
# pdf = SUMMARY_REPORT(pdf_path)
source_dir = path.join(Path(__file__).parent, "files")
pdf_path = path.join(source_dir, file_name)
pdf = SUMMARY_REPORT(pdf_path)

# pdf.add_text(markdown)
# write_file_path, write_file_name = path.join(temp_dir, file_name), file_name
# pdf.writer.write(write_file_path)
write_file_name = "temp_summary_file"
write_file_path = path.join(Path(__file__).parent, write_file_name)
with open(write_file_path, 'wb') as f:
f.write(markdown)


pdf.add_text(markdown)
write_file_path, write_file_name = path.join(temp_dir, file_name), file_name
pdf.writer.write(write_file_path)
return write_file_path, write_file_name


Expand Down
Loading