Some helper scripts for the day to day work with Ubuntu in WSL2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
729 B

import pathlib
import warnings
import click
from PyPDFForm import PdfWrapper
warnings.filterwarnings("ignore")
WINHOME = pathlib.Path("/mnt/c/Users/Holgi/")
DESKTOP = WINHOME / "Desktop"
@click.command()
@click.argument(
"form", type=click.Path(exists=True, file_okay=True, dir_okay=False)
)
@click.option(
"-o",
"--output",
default=None,
help="Output file path, defaults to desktop folder",
)
def inspect(form, output):
form = pathlib.Path(form)
if not output:
new_name = f"inspected {form.stem}{form.suffix}"
output = DESKTOP / new_name
preview_stream = PdfWrapper(str(form)).preview
with output.open("wb+") as output_stream:
output_stream.write(preview_stream)