Skip to content

Commit

Permalink
Remove "modified_pdf" argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Azeirah committed Nov 26, 2024
1 parent e89431e commit 3b3c1ea
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 34 deletions.
1 change: 0 additions & 1 deletion deployment/remarks-server/remarks_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"ann_type": ["scribbles", "highlights"],
"combined_pdf": True,
"combined_md": True,
"modified_pdf": False,
"md_hl_format": "whole_block",
"md_page_offset": 0,
"md_header_format": "atx",
Expand Down
7 changes: 0 additions & 7 deletions remarks/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ def main():
action="store_false",
help="Skip the creation of the default '*_remarks.pdf' file that contains all annotated pages merged into the original PDF file",
)
parser.add_argument(
"--modified_pdf",
dest="modified_pdf",
action="store_true",
help="Create a '*_remarks-only.pdf' file with annotated pages only (unannotated ones will be out)",
)
parser.add_argument(
"-v",
"--version",
Expand All @@ -61,7 +55,6 @@ def main():

parser.set_defaults(
combined_pdf=True,
modified_pdf=False,
)

args = parser.parse_args()
Expand Down
25 changes: 0 additions & 25 deletions remarks/remarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
get_visible_name,
get_ui_path,
load_json_file,
prepare_subdir,
RM_WIDTH,
RM_HEIGHT,
)
Expand Down Expand Up @@ -89,17 +88,10 @@ def process_document(
out_path,
ann_type=None,
combined_pdf=False,
modified_pdf=False,
):
document = Document(metadata_path)
pdf_src = document.open_source_pdf()

pages_magnitude = document.pages_magnitude()

if modified_pdf:
mod_pdf = fitz.open()
pages_order = []

obsidian_markdown = ObsidianMarkdownFile(document)
obsidian_markdown.add_document_header()

Expand Down Expand Up @@ -204,10 +196,6 @@ def process_document(
ann_page = add_smart_highlight_annotations(smart_hl_data, ann_page, scale)
smart_hl_groups = extract_groups_from_smart_hl(smart_hl_data)

if modified_pdf and (has_annotations or has_smart_highlights):
mod_pdf.insert_pdf(work_doc, start_at=-1)
pages_order.append(page_idx)

# If there are annotations outside the original page limits
# that we've just (re)created from scratch
if combined_pdf and is_ann_out_page:
Expand Down Expand Up @@ -239,19 +227,6 @@ def process_document(
if combined_pdf:
pdf_src.save(f"{out_doc_path_str} _remarks.pdf")

if modified_pdf and (document.doc_type == "notebook" and combined_pdf):
logging.info(
"- You asked for the modified PDF, but we won't bother generated it for this notebook. It would be the same as the combined PDF, which you're already getting anyway"
)
elif modified_pdf:
pages_order = sorted(
range(len(pages_order)),
key=pages_order.__getitem__,
)
mod_pdf.select(pages_order)
mod_pdf.save(f"{out_doc_path_str} _remarks-only.pdf")
mod_pdf.close()

obsidian_markdown.save(out_doc_path_str)

pdf_src.close()
2 changes: 1 addition & 1 deletion test_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from syrupy.extensions.single_file import SingleFileSnapshotExtension
import remarks

default_args = {"ann_type": ["scribbles", "highlights"], "combined_pdf": True, "modified_pdf": False}
default_args = {"ann_type": ["scribbles", "highlights"], "combined_pdf": True}


class JPEGImageExtension(SingleFileSnapshotExtension):
Expand Down

0 comments on commit 3b3c1ea

Please sign in to comment.