At the end of every month, I made a move to print a pdf file, stamp it, and then scan it. Therefore, I made a command line tool that electronically stamps because I don't want to stamp it too much.
Click here for the repository GitHub
it's simple.
$ pip install auto-ohin
Prepare the following items.
--The pdf file you want to stamp --Electronic seal (transparent image (png)) --config file (described later)
Prepare the config file required for stamping. It is possible to write in Json format, but it also supports Jsonnet. For example, create the following file with a text editor and save it in a suitable location with a suitable name.
This time, let's assume that it was saved as path / to / config.jsonnet
.
local root = "path/to/root/"; #Parent directory for storing various files
local pathgen(path) = root + path;
{
"input_path": pathgen("input.pdf"), #The pdf file name you want to imprint
"save_path": pathgen("output.pdf"), #Output file name(Note that it will be rewritten if it exists)
"img_path": pathgen("inkan.png "), #File name of electronic seal stamp
"obj_pages": [1, 3], #An array of page numbers to be stamped. It starts from 1.
"position": [147, 225], #With the lower left as the origin[x, y]Fill in the format. The unit is mm.
"img_size": [20, 20], # [Width height]Enter as. The unit is pixels.
"pdf_size": "A4" #For now, A0~It corresponds to A5.
}
If you execute the following on the command line, the pdf after stamping will be created in the location specified in the config file.
$ auto-ohin path/to/config.jsonnet
Future prospects: Since there are many arguments, I made it a format to prepare config, but it is difficult for people who are not familiar with Json to use it, so I would like to do something about it. We are looking for ideas.
It can also be used to put a watermark on each page of P.S.pdf, or put a specific icon in the footer position of even-numbered pages.
Recommended Posts