Skip to main content

拆分由封面上的 QR 码标识的多个考试组成的 pdf

项目描述

split_qr_exam

该程序拆分由扫描考试组成的 pdf。输入是一个包含多个扫描检查的 pdf 文件。在每个考试封面上都应该有一个 QR 码,用于识别正在撰写此考试的学生。对于考试的每个部分,将创建一个文件夹,并为每个学生在该文件夹中创建一个 pdf,以允许并行评估。为确保匿名,文件以学生 ID 的 sha256 哈希命名。

为此,您必须指定考试的所有部分以及相应的页数。

安装

该程序可以使用 pip 安装

从 PyPI 获取最新版本

pip install split_qr_exam

获取最新的开发快照

pip install git+https://github.com/christofsteel/split_qr_exam.git

两者还将安装所有需要的要求,即pymupdfpython-opencv2-headless注意:这将在整个命令split_qr_exam系统范围内安装。如果您只想以当前用户身份安装它,则应添加--userpip install命令中。

用法

usage: split_qr_exam [-h] [-t THRESHOLD] [-s SHRINK] [-c CROP] [-T] [-S] [-C] -p PART [-d] [-b] pdf [dest]

Split a scanned examfile into folders for each student and tasks in seperate pdf files. The input PDF should have a QR code identifying the student on the cover of each exam.

positional arguments:
  pdf                   The pdf file to split
  dest                  Destination folder. Default is the current directory

optional arguments:
  -h, --help            show this help message and exit
  -t THRESHOLD, --threshold THRESHOLD
                        Set the threshold for the cleanup phase. Values range from 0 to 255. Lower value means more grey is detected as white, higher value means more grey is detected as black. Only impacts the QR detection phase. Default: 127
  -s SHRINK, --shrink SHRINK
                        Width of the image in pixel for the QR code detection phase. Lower value means more performance, higher value means more accuracy. Only impacts the QR detection phase, does not affect the output PDF. Default: 600
  -c CROP, --crop CROP  Fractional coordinates, that represent the area of the coverpage, where the QR code is located. The format is "x1,y1:x2,y2" where x1, x2, y1, y2 are values from 0 to 1. Default is "0,0.5:0.5,1" which corresponds to the top right
                        quartal of the image.
  -T, --no-cleanup      Skip cleanup phase
  -S, --no-shrink       Skip shrinking phase
  -C, --no-crop         Skip cropping phase
  -p PART, --part PART  Name and amount of pages for the parts of the exam, seperated by a colon. Can (and should) be issued multiple times (Example "-p Cover:1 -p Task1:2"). Should also include a part for the cover sheet, and empty bonus sheets. The
                        number of pages should not include the backsides, if the document is scanned in duplex. Use --is-double-sided instead
  -d, --is-double-sided
                        The exam is scanned in duplex. The split output pdf will also include the last backside of the previous part, since students tend to also write solutions there
  -b, --last-part-is-bonus
                        The last part are bonus sheets. There will be a seperate pdf for each bonus sheet.

Example of use:
        split_qr_exam -p cover:1 -p task1:2 -p task2:3 -p task3:1 -p bonus:3 -b -d scanned_exams.pdf ~/splitexams/

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

split_qr_exam-0.1.3.tar.gz (10.9 kB 查看哈希

已上传 source

内置分布

split_qr_exam-0.1.3-py3-none-any.whl (22.6 kB 查看哈希

已上传 py3