-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgtk-gnome2-pdftk
executable file
·163 lines (142 loc) · 4.76 KB
/
gtk-gnome2-pdftk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/bash
#pdftk nautilus-script for gnome2
#edit by flow. mail: bandari.fans@163.com
#dependencies
#pdftk
#move this file into ~/.gnome2/nautilus-scripts then `chmod 755 filename`
case $LANG in
en*)
getback ()
{
zenity --title="choose a background pdf file" --file-selection --file-filter=*.pdf
}
getoutput ()
{
zenity --title="save as" --width=600 --height=600 --file-selection --save --file-filter=*.pdf --confirm-overwrite
}
getinput_mul()
{
zenity --title="choose pdf files you wanna merge" --width=700 --file-selection --file-filter=*.pdf --multiple
}
inputpasswd()
{
zenity --title="enter password" --text="please enter a passwd" --entry --hide-text
}
jiamiop()
{
zenity --title="choose a option" --width=550 --hide-header --list --radiolist --print-column=3 --hide-column=3 --column=x --column=y --column=z x "set a owner passwd to prevent print or edit pdf" jm1 x "set a user passwd and when you read it you need enter passwd" jm2
}
inputf()
{
zenity --title="choose some files you want to add in pdf" --width=600 --height=400 --file-selection --multiple
}
getpagenum()
{
zenity --title="add attach" --entry --text="enter a page number" --entry-text=1
}
rou()
{
zenity --title=rotate --width=400 --height=200 --list --text="choose angle of rotation" --print-column=3 --radiolist --hide-header --hide-column=3 --column=x --column=y --column=z x "rotate the image 90 degrees to the right" E x "rotate the image 180 degrees to the right" S x "rotate the image 270 degrees to the right" W x "rotate the image 90 degrees to the left" L
}
delpage()
{
zenity --title="del page" --entry --text="enter the page number you wanna delete" --entry-text=1
}
sel()
{
zenity --title="choose a opreation" --width=400 --height=400 --list --radiolist --print-column=3 --hide-header --hide-column=3 --column=x --column=y --column=z x "choose files to merge" hebing x encrypt jiami x decrypt jiemi x compress yasuo x "view pdf data" information x "delete page" del x brust brust x stamp stamp x "repair pdf files" repair x "add files to pdf" addfiles x "unpack files" unpack x rotate rotate
}
;;
zh* )
getback ()
{
zenity --title="选择水印pdf文件" --file-selection --file-filter=*.pdf
}
getoutput ()
{
zenity --title="保存为" --file-selection --save --file-filter=*.pdf --confirm-overwrite
}
getinput_mul()
{
zenity --title="选择要合并的文件" --width=700 --file-selection --file-filter=*.pdf --multiple
}
inputpasswd()
{
zenity --title="输入密码" --text="enter a passwd" --entry --hide-text
}
jiamiop()
{
zenity --title="选择一个选项" --list --radiolist --print-column=3 --hide-column=3 --column=x --column=y --column=z x 只加密文档防止修改打印 jm1 x 加密文档,打开时要求输入密码 jm2
}
inputf()
{
zenity --title="选择要插入的文件,可多选" --width=600 --height=400 --file-selection --multiple
}
getpagenum()
{
zenity --title="插入文件" --entry --text="输入要插入的页码" --entry-text=1
}
rou()
{
zenity --title=旋转 --list --text="选择要旋转的角度" --print-column=3 --radiolist --hide-header --hide-column=3 --column=x --column=y --column=z x 顺时针旋转90度 E x 顺时针旋转180度 S x 顺时针旋转270度 W x 逆时针旋转90度 L
}
delpage()
{
zenity --title="删除页面" --entry --text="输入要删除的页面" --entry-text=1
}
sel()
{
zenity --title="choose a opreation" --width=400 --height=400 --list --radiolist --print-column=3 --hide-header --hide-column=3 --column=x --column=y --column=z x 选择文件进行合并(可多选) hebing x 加密 jiami x 清除密码 jiemi x 压缩 yasuo x 查看信息 information x 删除某页 del x 将文件每页分为单个文档 brust x 添加水印 stamp x 修复损坏的pdf repair x 添加附件到文档 addfiles x 将附件提取到当前目录 unpack x 旋转 rotate
}
;;
esac
case "$(sel)" in
stamp)
pdftk "$@" stamp "$(getback)" output "$(getoutput)".pdf
;;
hebing)
pdftk "$@" "$(getinput_mul)" cat output "$(getoutput)".pdf
;;
jiami)
if [ $(jiamiop) = jm1 ]
then
pass=$(inputpasswd)
pdftk "$@" output "$(getoutput)".pdf owner_pw $pass
else
pass=$(inputpasswd)
pdftk "$@" output "$(getoutput)".pdf user_pw $pass
fi
;;
jiemi)
pdftk "$@" input_pw "$(inputpasswd)" output "$(getoutput)".pdf
;;
yasuo)
pdftk "$@" output "$(getoutput)".pdf compress
;;
information)
pdftk "$@" dump_data output info.txt
zenity --text-info --filename=info.txt
rm info.txt
;;
addfiles)
pdftk "$@" attach_files "$(inputf)" to_page "$(getpagenum)" output "$(getoutput)".pdf
;;
burst)
pdftk "$@" burst
;;
repair)
pdftk "$@" output "$(getoutput)".pdf
;;
unpack)
pdftk "$@" unpack_files output
;;
rotate)
pdftk "$@" cat "1-end$(rou)" output "$(getoutput)".pdf
;;
del)
mm="$(delpage)"
let fr1=mm-1
let be1=mm+1
pdftk "$@" cat "1-$fr1" "$be1-end" output "$(getoutput)".pdf
;;
esac