Benjamin Renard commited on 2014-04-29 17:41:51
Showing 15 changed files, with 277 additions and 0 deletions.
... | ... |
@@ -0,0 +1 @@ |
1 |
+7 |
... | ... |
@@ -0,0 +1,14 @@ |
1 |
+Source: compress-pdf |
|
2 |
+Section: gnome |
|
3 |
+Priority: optional |
|
4 |
+Build-Depends: debhelper |
|
5 |
+Maintainer: Benjamin Renard <brenard@zionetrix.net> |
|
6 |
+Homepage: http://git.zionetrix.net/compress-pdf |
|
7 |
+ |
|
8 |
+Package: compress-pdf |
|
9 |
+Section: x11 |
|
10 |
+Architecture: all |
|
11 |
+Depends: zenity, ghostscript |
|
12 |
+Maintainer: Benjamin Renard <brenard@zionetrix.net> |
|
13 |
+Description: graphical tool to compress PDF file using GhostScript |
|
14 |
+ Compress PDF is a graphical tool to compress PDF file using GhostScript and zenity for UI. |
... | ... |
@@ -0,0 +1,24 @@ |
1 |
+This package was debianized by Benjamin Renard <brenard@zionetrix.net> on |
|
2 |
+Tue, 29 Apr 2014 19:06:13 +0200. |
|
3 |
+ |
|
4 |
+This package was build from Compress PDF sources version 1.4 adapted by packager. |
|
5 |
+ |
|
6 |
+Original source is available here : |
|
7 |
+ |
|
8 |
+https://launchpad.net/compress-pdf/ |
|
9 |
+ |
|
10 |
+Copyright: |
|
11 |
+ |
|
12 |
+ compress-pdf is copyright (C) 2010 Ricardo Ferreira |
|
13 |
+ |
|
14 |
+ This software is issued from GNU GENERAL PUBLIC LICENSE Version 3 |
|
15 |
+ |
|
16 |
+License: |
|
17 |
+ |
|
18 |
+ You can use it under GNU GENERAL PUBLIC LICENSE Version 3 policy |
|
19 |
+ |
|
20 |
+ For more information on GNU GENERAL PUBLIC LICENSE Version 3 policy, |
|
21 |
+ please refer to COPYING. |
|
22 |
+ |
|
23 |
+The Debian packaging is (C) 2013, Benjamin Renard <brenard@zionetrix.net> and |
|
24 |
+is licensed under the GNU GENERAL PUBLIC LICENSE Version too. |
... | ... |
@@ -0,0 +1,212 @@ |
1 |
+#! /bin/bash |
|
2 |
+ |
|
3 |
+# AUTHOR: (c) Ricardo Ferreira |
|
4 |
+# NAME: Compress PDF 1.4 |
|
5 |
+# DESCRIPTION: A nice Nautilus script with a GUI to compress and optimize PDF files |
|
6 |
+# REQUIRES: ghostscript, poppler-utils, zenity |
|
7 |
+# LICENSE: GNU GPL v3 (http://www.gnu.org/licenses/gpl.html) |
|
8 |
+# WEBSITE: https://launchpad.net/compress-pdf |
|
9 |
+ |
|
10 |
+# Messages |
|
11 |
+ # English (en-US) |
|
12 |
+ error_nofiles="No file selected." |
|
13 |
+ error_noquality="No optimization level selected." |
|
14 |
+ error_ghostscript="PDF Compress requires the ghostscript package, which is not installed. Please install it and try again." |
|
15 |
+ error_nopdf="The selected file is not a valid PDF archive." |
|
16 |
+ label_filename="Save PDF as..." |
|
17 |
+ label_level="Please choose an optimization level below." |
|
18 |
+ optimization_level="Optimization Level" |
|
19 |
+ level_default="Default" |
|
20 |
+ level_screen="Screen-view only" |
|
21 |
+ level_low="Low Quality" |
|
22 |
+ level_high="High Quality" |
|
23 |
+ level_color="High Quality (Color Preserving)" |
|
24 |
+ job_done="has been successfully compressed" |
|
25 |
+ |
|
26 |
+case $LANG in |
|
27 |
+ |
|
28 |
+ pt* ) |
|
29 |
+ # Portuguese (pt-PT) |
|
30 |
+ error_nofiles="Nenhum ficheiro seleccionado." |
|
31 |
+ error_noquality="Nenhum nível de optimização escolhido." |
|
32 |
+ error_ghostscript="O PDF Compress necessita do pacote ghostscript, que não está instalado. Por favor instale-o e tente novamente." |
|
33 |
+ error_nopdf="O ficheiro seleccionado não é um ficheiro PDF válido." |
|
34 |
+ label_filename="Guardar PDF como..." |
|
35 |
+ label_level="Por favor escolha um nível de optimização abaixo." |
|
36 |
+ optimization_level="Nível de Optimização" |
|
37 |
+ level_default="Normal" |
|
38 |
+ level_screen="Visualização no Ecrã" |
|
39 |
+ level_low="Baixa Qualidade" |
|
40 |
+ level_high="Alta Qualidade" |
|
41 |
+ level_color="Alta Qualidade (Preservação de Cores)" |
|
42 |
+ job_done="foi comprimido com sucesso";; |
|
43 |
+ |
|
44 |
+ |
|
45 |
+ es* ) |
|
46 |
+ # Spanish (es-AR) by Eduardo Battaglia |
|
47 |
+ error_nofiles="Ningún archivo seleccionado." |
|
48 |
+ error_noquality="Ningún nivel de optimización escogido." |
|
49 |
+ error_ghostscript="Compress PDF necesita el paquete ghostscript, que no está instalado. Por favor instálelo e intente nuevamente." |
|
50 |
+ label_filename="Guardar PDF como..." |
|
51 |
+ label_level="Por favor escoja un nivel de optimización debajo." |
|
52 |
+ optimization_level="Nivel de Optimización" |
|
53 |
+ level_default="Normal" |
|
54 |
+ level_screen="Sólo visualización" |
|
55 |
+ level_low="Baja calidad" |
|
56 |
+ level_high="Alta calidad" |
|
57 |
+ level_color="Alta calidad (Preservación de Colores)";; |
|
58 |
+ |
|
59 |
+ |
|
60 |
+ cs*) |
|
61 |
+ # Czech (cz-CZ) by Martin Pavlík |
|
62 |
+ error_nofiles="Nebyl vybrán žádný soubor." |
|
63 |
+ error_noquality="Nebyla zvolena úroveň optimalizace." |
|
64 |
+ error_ghostscript="PDF Compress vyžaduje balíček ghostscript, který není nainstalován. Nainstalujte jej prosím a opakujte akci." |
|
65 |
+ label_filename="Uložit PDF jako..." |
|
66 |
+ label_level="Prosím vyberte úroveň optimalizace z níže uvedených." |
|
67 |
+ optimization_level="Úroveň optimalizace" |
|
68 |
+ level_default="Výchozí" |
|
69 |
+ level_screen="Pouze pro čtení na obrazovce" |
|
70 |
+ level_low="Nízká kvalita" |
|
71 |
+ level_high="Vysoká kvalita" |
|
72 |
+ level_color="Vysoká kvalita (se zachováním barev)";; |
|
73 |
+ |
|
74 |
+ |
|
75 |
+ fr*) |
|
76 |
+ # French (fr-FR) by Astromb |
|
77 |
+ error_nofiles="Aucun fichier sélectionné" |
|
78 |
+ error_noquality="Aucun niveau d'optimisation sélectionné" |
|
79 |
+ error_ghostscript="PDF Compress a besoin du paquet ghostscript, mais il n'est pas installé. Merci de l'installer et d'essayer à nouveau." |
|
80 |
+ error_nopdf="Le fichier que vous avez sélectionné n'est pas un PDF valide." |
|
81 |
+ label_filename="Sauvegarder le PDF sous..." |
|
82 |
+ label_level="Merci de choisir, ci-dessous, un niveau d'optimisation." |
|
83 |
+ optimization_level="Niveau d'optimisation" |
|
84 |
+ level_default="Défaut" |
|
85 |
+ level_screen="Affichage à l'écran" |
|
86 |
+ level_low="Basse qualité" |
|
87 |
+ level_high="Haute qualité" |
|
88 |
+ level_color="Haute qualité (Couleurs préservées)" |
|
89 |
+ job_done="a bien été compressé";; |
|
90 |
+ |
|
91 |
+ zh_CN*) |
|
92 |
+ # Simplified Chinese (zh_CN) by TualatriX Chou |
|
93 |
+ error_nofiles="没有选择文件。" |
|
94 |
+ error_noquality="没有优化优化等级。" |
|
95 |
+ error_ghostscript="PDF压缩需要ghostscript软件包,但是它没有安装。请先安装然后再重试。" |
|
96 |
+ error_nopdf="选择的文件不是一个有效的PDF文件" |
|
97 |
+ label_filename="另存为PDF..." |
|
98 |
+ label_level="请在下面选择优化等级" |
|
99 |
+ optimization_level="优化等级" |
|
100 |
+ level_default="默认" |
|
101 |
+ level_screen="仅在屏幕上浏览" |
|
102 |
+ level_low="低品质" |
|
103 |
+ level_high="高品质" |
|
104 |
+ level_color="高品质(护色) ";; |
|
105 |
+ |
|
106 |
+ ar*) |
|
107 |
+ # Arabic (ar) by Mohammed hasan Taha |
|
108 |
+ error_nofiles="لم يتم اختيار ملف" |
|
109 |
+ error_noquality="لم يتم اختيار درجة الضغط" |
|
110 |
+ error_ghostscript="هذا السكربت يحتاج حزمة ghostscript package لذا يرجى تنصيبها ثم اعادة المحاولة" |
|
111 |
+ error_nopdf="الملف الذي تم اختياره ليس ملف pdf صالح" |
|
112 |
+ label_filename="حفظ الملف باسم" |
|
113 |
+ label_level="الرجاء اختيار درجة الضغط" |
|
114 |
+ optimization_level="درجة الضغط" |
|
115 |
+ level_default="افتراضي" |
|
116 |
+ level_screen="عرض للشاشة فقط(الدرجة الأكثر انخفاضا)" |
|
117 |
+ level_low="جودة منخفضة" |
|
118 |
+ level_high="جودة مرتفعة" |
|
119 |
+ level_color="جودة عالية جدا";; |
|
120 |
+ |
|
121 |
+ ml_IN*) |
|
122 |
+ # Malayalam (ml_IN) by Hrishikesh K B |
|
123 |
+ error_nofiles="ഒരു ഫയലും തിരഞ്ഞെടുത്തിട്ടില്ല." |
|
124 |
+ error_noquality="യാതൊരു ഒപ്റ്റിമൈസേഷന് ലെവലും തിരഞ്ഞെടുത്തിട്ടില്ല." |
|
125 |
+ error_ghostscript="പി ഡി എഫ് കംപ്രസ്സറിന് ഗോസ്റ്റ് സ്ക്രിപ്റ്റ് പാക്കേജ് ആവശ്യമാണ്. ആ പാക്കേജ് ഇന്സ്റ്റാള് ചെയ്ത ശേഷം ദയവായി വീണ്ടും ശ്രമിക്കുക." |
|
126 |
+ error_nopdf="തിരഞ്ഞെടുത്ത ഫയല് സാധുവായ ഒരു പിഡിഎഫ് ആര്ച്ചീവ് അല്ല." |
|
127 |
+ label_filename="പിഡിഎഫ് ഇങ്ങിനെ സംരക്ഷിക്കുക..." |
|
128 |
+ label_level="ദയവായി താഴെ നിന്നും ഒരു ഒപ്റ്റിമൈസേഷന് ലെവല് തിരഞ്ഞെടുക്കുക." |
|
129 |
+ optimization_level="ഒപ്റ്റിമൈസേഷന് ലെവല് " |
|
130 |
+ level_default="ഡീഫാള്ട്ട്" |
|
131 |
+ level_screen="സ്ക്രീനില് കാണാന് മാത്രം " |
|
132 |
+ level_low="കുറഞ്ഞ നിലവാരം" |
|
133 |
+ level_high="കൂടിയ നിലവാരം " |
|
134 |
+ level_color="കൂടിയ നിലവാരം (നിറം സംരക്ഷിച്ചിട്ടുള്ളത്)" |
|
135 |
+ |
|
136 |
+esac |
|
137 |
+ |
|
138 |
+VERSION="1.1" |
|
139 |
+ZENITY=$(which zenity) |
|
140 |
+ |
|
141 |
+pdf_file=$(basename "$1") |
|
142 |
+ |
|
143 |
+# Check if Ghostscript is installed |
|
144 |
+GS="/usr/bin/ghostscript" |
|
145 |
+if [ ! -x $GS ]; then |
|
146 |
+ $ZENITY --error --title="Compress PDF "$VERSION"" --text="$error_ghostscript" |
|
147 |
+ exit 0; |
|
148 |
+fi |
|
149 |
+ |
|
150 |
+# Check if the user has selected any files |
|
151 |
+if [ ! -z "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then |
|
152 |
+ pdf_file="$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" |
|
153 |
+elif [ -z "$pdf_file" ]; then |
|
154 |
+ pdf_file=$($ZENITY --file-selection --file-filter="*.pdf" --title="$label_filename") |
|
155 |
+ [ $? -ne 0 ] && exit 0 |
|
156 |
+fi |
|
157 |
+ |
|
158 |
+# Check if the selected file is a PDF... |
|
159 |
+mimetype=$(file -b -i "$pdf_file") |
|
160 |
+if [ -z "`echo $mimetype | grep -i 'pdf' `" ]; then |
|
161 |
+ $ZENITY --error --title="Compress PDF "$VERSION"" --text="$error_nopdf" |
|
162 |
+ exit 0; |
|
163 |
+fi |
|
164 |
+ |
|
165 |
+# Ask the user to select a compressing format |
|
166 |
+selected_level=$($ZENITY --list --title="Compress PDF "$VERSION"" --text "$label_level" --radiolist --column "" --column "$optimization_level" TRUE "$level_default" FALSE "$level_screen" FALSE "$level_low" FALSE "$level_high" FALSE "$level_color") |
|
167 |
+if [ -z "$selected_level" ]; then |
|
168 |
+ $ZENITY --error --title="Compress PDF "$VERSION"" --text="$error_noquality" |
|
169 |
+ exit 0; |
|
170 |
+fi |
|
171 |
+ |
|
172 |
+# Select the optimization level to use |
|
173 |
+case $selected_level in |
|
174 |
+ "$level_default") |
|
175 |
+ COMP_COMMAND="/default" |
|
176 |
+ ;; |
|
177 |
+ "$level_screen") |
|
178 |
+ COMP_COMMAND="/screen" |
|
179 |
+ ;; |
|
180 |
+ "$level_low") |
|
181 |
+ COMP_COMMAND="/ebook" |
|
182 |
+ ;; |
|
183 |
+ "$level_high") |
|
184 |
+ COMP_COMMAND="/printer" |
|
185 |
+ ;; |
|
186 |
+ "$level_color") |
|
187 |
+ COMP_COMMAND="/prepress" |
|
188 |
+ ;; |
|
189 |
+esac |
|
190 |
+ |
|
191 |
+# Choose output file name |
|
192 |
+suggested_filename=compressed-"$pdf_file" |
|
193 |
+output_filename=$($ZENITY --file-selection --save --confirm-overwrite --filename="$suggested_filename" --title="$label_filename") |
|
194 |
+ |
|
195 |
+if [ "$?" = 1 ] ; then |
|
196 |
+ exit 0; |
|
197 |
+fi |
|
198 |
+temp_filename="$( dirname "$output_filename")/.$( basename "$output_filename").temp" |
|
199 |
+ |
|
200 |
+# Execute ghostscript while showing a progress bar |
|
201 |
+(echo "0" ; |
|
202 |
+ gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=$COMP_COMMAND -dNOPAUSE -dQUIET -dBATCH -sOutputFile="$temp_filename" "$pdf_file"; |
|
203 |
+ rm -f "$temp_filename_pdfmarks"; |
|
204 |
+ echo "100") | (if `$ZENITY --progress --pulsate --auto-close --title="Compress PDF "$VERSION""`; |
|
205 |
+ then |
|
206 |
+ mv -f "$temp_filename" "$output_filename" & |
|
207 |
+ notify-send "Compress PDF" "$pdf_file $job_done" |
|
208 |
+ else |
|
209 |
+ killall gs |
|
210 |
+ rm -f "$temp_filename" |
|
211 |
+ exit |
|
212 |
+ fi) |
... | ... |
@@ -0,0 +1,9 @@ |
1 |
+[Desktop Entry] |
|
2 |
+Name=Compress PDF |
|
3 |
+Comment=Compress PDF file |
|
4 |
+Exec=compress-pdf |
|
5 |
+Terminal=false |
|
6 |
+Type=Application |
|
7 |
+Icon=compress-pdf |
|
8 |
+Categories=GNOME;GTK;Office;Viewer;Graphics;VectorGraphics; |
|
9 |
+MimeType=application/pdf;application/x-bzpdf;application/x-gzpdf;application/x-xzpdf; |