├── PDF Nano.workflow
└── Contents
│ ├── QuickLook
│ └── Preview.png
│ ├── Info.plist
│ └── document.wflow
├── LICENSE
└── README.md
/PDF Nano.workflow/Contents/QuickLook/Preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhlnzhng/PDF-nano/HEAD/PDF Nano.workflow/Contents/QuickLook/Preview.png
--------------------------------------------------------------------------------
/PDF Nano.workflow/Contents/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSServices
6 |
7 |
8 | NSMenuItem
9 |
10 | default
11 | PDF Nano
12 |
13 | NSMessage
14 | runWorkflowAsService
15 | NSRequiredContext
16 |
17 | NSApplicationIdentifier
18 | com.apple.finder
19 |
20 | NSSendFileTypes
21 |
22 | com.adobe.pdf
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Taufook
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PDF Nano
2 |
3 | [DMG Version here][1]
4 |
5 | PDF Nano could dramatically reduce the size of PDF, while keeping the images and texts clear enough for screen readers.
6 |
7 | Actually, PDF Nano is an **Automator workflow**, therefore it works on **macOS only**, as a service on the context menu.
8 |
9 | ## Prerequisites
10 |
11 | You will need **Ghostscript**, a famous interpreter for the PostScript language and for PDF.
12 |
13 | To install [Ghostscript][2], you can:
14 | * follow [the official guide][3]
15 | * or use [Homebrew][4]:`brew install ghostscript `
16 | * or download and open [this install package][5]
17 |
18 | ## Install PDF Nano
19 |
20 | Open `PDF Nano.workflow` and install the service.
21 |
22 | ## Usage
23 |
24 | Right-click the PDF and select `PDF Nano` service on the context menu, and just wait for the magic.
25 |
26 | ## Notes
27 |
28 | * The magic may come slowly if the PDF is large. For example, it may take 40s to compress a PDF from 40MB to 2MB. Yeah, I know it’s a bit slow.
29 | * Maybe not just a bit.
30 | * File stream is not supported yet.
31 |
32 | ## License
33 |
34 | MIT
35 |
36 | [1]: https://www.dropbox.com/s/j8kaulw8s9kl406/PDF%20Nano.dmg?dl=0
37 | [2]: https://ghostscript.com/index.html
38 | [3]: https://ghostscript.com/doc/9.23/Install.htm#Install_Unix
39 | [4]: https://brew.sh/
40 | [5]: http://pages.uoregon.edu/koch/
41 |
--------------------------------------------------------------------------------
/PDF Nano.workflow/Contents/document.wflow:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | AMApplicationBuild
6 | 444.4
7 | AMApplicationVersion
8 | 2.8
9 | AMDocumentVersion
10 | 2
11 | actions
12 |
13 |
14 | action
15 |
16 | AMAccepts
17 |
18 | Container
19 | List
20 | Optional
21 |
22 | Types
23 |
24 | com.apple.cocoa.string
25 |
26 |
27 | AMActionVersion
28 | 2.0.3
29 | AMApplication
30 |
31 | 自动操作
32 |
33 | AMParameterProperties
34 |
35 | COMMAND_STRING
36 |
37 | CheckedForUserDefaultShell
38 |
39 | inputMethod
40 |
41 | shell
42 |
43 | source
44 |
45 |
46 | AMProvides
47 |
48 | Container
49 | List
50 | Types
51 |
52 | com.apple.cocoa.string
53 |
54 |
55 | ActionBundlePath
56 | /System/Library/Automator/Run Shell Script.action
57 | ActionName
58 | 运行 Shell 脚本
59 | ActionParameters
60 |
61 | COMMAND_STRING
62 | export PATH=/usr/local/bin:$PATH
63 | cd "$(dirname "$1")"
64 | filename=$(basename "$1" .pdf)
65 | for f in "$@"
66 | do
67 | gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile="$filename.pdf.still.working" "$f"
68 | mv "$filename.pdf.still.working" "$filename.nano.pdf"
69 | done
70 | CheckedForUserDefaultShell
71 |
72 | inputMethod
73 | 1
74 | shell
75 | /bin/bash
76 | source
77 |
78 |
79 | BundleIdentifier
80 | com.apple.RunShellScript
81 | CFBundleVersion
82 | 2.0.3
83 | CanShowSelectedItemsWhenRun
84 |
85 | CanShowWhenRun
86 |
87 | Category
88 |
89 | AMCategoryUtilities
90 |
91 | Class Name
92 | RunShellScriptAction
93 | InputUUID
94 | E8CDD070-550E-4579-BDE7-BE9D1EE3FA0E
95 | Keywords
96 |
97 | Shell
98 | 脚本
99 | 命令
100 | 运行
101 | Unix
102 |
103 | OutputUUID
104 | 6C0FAE7F-7871-425D-AEEB-A88ADE01B16E
105 | UUID
106 | B952DA6F-6988-4440-ABD1-E20F51C045B5
107 | UnlocalizedApplications
108 |
109 | Automator
110 |
111 | arguments
112 |
113 | 0
114 |
115 | default value
116 | 0
117 | name
118 | inputMethod
119 | required
120 | 0
121 | type
122 | 0
123 | uuid
124 | 0
125 |
126 | 1
127 |
128 | default value
129 |
130 | name
131 | source
132 | required
133 | 0
134 | type
135 | 0
136 | uuid
137 | 1
138 |
139 | 2
140 |
141 | default value
142 |
143 | name
144 | CheckedForUserDefaultShell
145 | required
146 | 0
147 | type
148 | 0
149 | uuid
150 | 2
151 |
152 | 3
153 |
154 | default value
155 |
156 | name
157 | COMMAND_STRING
158 | required
159 | 0
160 | type
161 | 0
162 | uuid
163 | 3
164 |
165 | 4
166 |
167 | default value
168 | /bin/sh
169 | name
170 | shell
171 | required
172 | 0
173 | type
174 | 0
175 | uuid
176 | 4
177 |
178 |
179 | isViewVisible
180 |
181 | location
182 | 309.000000:253.000000
183 | nibPath
184 | /System/Library/Automator/Run Shell Script.action/Contents/Resources/zh_CN.lproj/main.nib
185 |
186 | isViewVisible
187 |
188 |
189 |
190 | action
191 |
192 | AMAccepts
193 |
194 | Container
195 | List
196 | Optional
197 |
198 | Types
199 |
200 |
201 | AMActionVersion
202 | 1.0
203 | AMApplication
204 |
205 | 自动操作
206 |
207 | AMParameterProperties
208 |
209 | message
210 |
211 | tokenizedValue
212 |
213 | Compression Completed.
214 |
215 |
216 | subtitle
217 |
218 | title
219 |
220 | tokenizedValue
221 |
222 | PDF Nano
223 |
224 |
225 |
226 | AMProvides
227 |
228 | Container
229 | List
230 | Types
231 |
232 |
233 | ActionBundlePath
234 | /System/Library/Automator/Display Notification.action
235 | ActionName
236 | 显示通知
237 | ActionParameters
238 |
239 | message
240 | Compression Completed.
241 | subtitle
242 |
243 | title
244 | PDF Nano
245 |
246 | BundleIdentifier
247 | com.apple.Automator.Display-Notification
248 | CFBundleVersion
249 | 1.0
250 | CanShowSelectedItemsWhenRun
251 |
252 | CanShowWhenRun
253 |
254 | Category
255 |
256 | AMCategoryUtilities
257 |
258 | Class Name
259 | AMDisplayNotificationAction
260 | InputUUID
261 | F5E0E3E2-3992-4463-9A26-04564CE27D4F
262 | Keywords
263 |
264 | OutputUUID
265 | 82B8DD5B-D0EE-4463-ACD2-7E088E3324A7
266 | UUID
267 | 48435221-5381-4DE9-9A57-B7D255FB5671
268 | UnlocalizedApplications
269 |
270 | Automator
271 |
272 | arguments
273 |
274 | 0
275 |
276 | default value
277 |
278 | name
279 | subtitle
280 | required
281 | 0
282 | type
283 | 0
284 | uuid
285 | 0
286 |
287 | 1
288 |
289 | default value
290 |
291 | name
292 | title
293 | required
294 | 0
295 | type
296 | 0
297 | uuid
298 | 1
299 |
300 | 2
301 |
302 | default value
303 |
304 | name
305 | message
306 | required
307 | 0
308 | type
309 | 0
310 | uuid
311 | 2
312 |
313 |
314 | isViewVisible
315 |
316 | location
317 | 309.000000:443.000000
318 | nibPath
319 | /System/Library/Automator/Display Notification.action/Contents/Resources/Base.lproj/main.nib
320 |
321 | isViewVisible
322 |
323 |
324 |
325 | connectors
326 |
327 | 64D95043-B936-4EE6-94C6-AB11CC2BB259
328 |
329 | from
330 | B952DA6F-6988-4440-ABD1-E20F51C045B5 - B952DA6F-6988-4440-ABD1-E20F51C045B5
331 | to
332 | 48435221-5381-4DE9-9A57-B7D255FB5671 - 48435221-5381-4DE9-9A57-B7D255FB5671
333 |
334 |
335 | workflowMetaData
336 |
337 | serviceApplicationBundleID
338 | com.apple.finder
339 | serviceApplicationPath
340 | /System/Library/CoreServices/Finder.app
341 | serviceInputTypeIdentifier
342 | com.apple.Automator.fileSystemObject.PDF
343 | serviceOutputTypeIdentifier
344 | com.apple.Automator.nothing
345 | serviceProcessesInput
346 | 0
347 | workflowTypeIdentifier
348 | com.apple.Automator.servicesMenu
349 |
350 |
351 |
352 |
--------------------------------------------------------------------------------