Merge lp://staging/~1058424266-7/ubuntu-tweak-website/zhangmin into lp://staging/ubuntu-tweak-website/0.1.x
Status: | Needs review |
---|---|
Proposed branch: | lp://staging/~1058424266-7/ubuntu-tweak-website/zhangmin |
Merge into: | lp://staging/ubuntu-tweak-website/0.1.x |
To merge this branch: | bzr merge lp://staging/~1058424266-7/ubuntu-tweak-website/zhangmin |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Tweak Web Team | Pending | ||
Review via email: mp+82783@code.staging.launchpad.net |
Description of the change
#!/bin/bash
#pdftk gui nautilus-script
#this is a pdftk nautilus-script for gnome2,can do some jobs whit PDF files
# AUTHOR: flow
# NAME: pdftk-nautilus-
#mail: bandari.
#dependencies
#pdftk pdfcrack
#move this file into ~/.gnome2/
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 an 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 "crack pdf password" crack 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
}
result()
{
if [ $? = 1 ]
then zenity --title "error" --info --text="error "
else
zenity --title "pdftk" --info --text=success
fi
}
;;
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=
}
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
}
result()
{
if [ $? = 1 ]
then zenity --title "error" --info --text="错误 "
else
zenity --title "pdftk" --info --text="完成"
fi
}
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 破解密码 crack 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
$(result)
;;
hebing)
pdftk "$@" "$(getinput_mul)" cat output "$(getoutput)".pdf
$(result)
;;
jiami)
if [ $(jiamiop) = jm1 ]
then
pass=
pdftk "$@" output "$(getoutput)".pdf owner_pw $pass
else
pass=
pdftk "$@" output "$(getoutput)".pdf user_pw $pass
fi
;;
jiemi)
pdftk "$@" input_pw "$(inputpasswd)" output "$(getoutput)".pdf
"$(result)"
;;
yasuo)
pdftk "$@" output "$(getoutput)".pdf compress
$(result)
;;
information)
pdftk "$@" dump_data output info.txt
zenity --title=information --text-info --filename=info.txt
rm info.txt
;;
addfiles)
pdftk "$@" attach_files "$(inputf)" to_page "$(getpagenum)" output "$(getoutput)".pdf
$(result)
;;
burst)
pdftk "$@" burst
"$(result)"
;;
repair)
get=$(getoutput)
pdftk "$@" output "$get".pdf
$(result)
;;
unpack)
pdftk "$@" unpack_files output
$(result)
;;
rotate)
pdftk "$@" cat "1-end$(rou)" output "$(getoutput)".pdf
$(result)
;;
crack)
pdfcrack -o "$@" |tee info.txt | `zenity --progress --pulsate --auto-close --title="cracking"`
zenity --text-info --filename=info.txt
rm info.txt
;;
del)
mm="$(delpage)"
let fr1=mm-1
let be1=mm+1
pdftk "$@" cat "1-$fr1" "$be1-end" output "$(getoutput)".pdf
$(result)
;;
esac