https://github.com/rodrigobdz/pdfoptim
Optimize file size of PDFs
https://github.com/rodrigobdz/pdfoptim
generator-lnm ghostscript imageoptim minification nodejs npm-package optimization-tools performance yarn
Last synced: 5 months ago
JSON representation
Optimize file size of PDFs
- Host: GitHub
- URL: https://github.com/rodrigobdz/pdfoptim
- Owner: rodrigobdz
- License: mit
- Created: 2019-04-23T12:52:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-23T17:25:57.000Z (over 6 years ago)
- Last Synced: 2024-11-29T02:59:19.974Z (about 1 year ago)
- Topics: generator-lnm, ghostscript, imageoptim, minification, nodejs, npm-package, optimization-tools, performance, yarn
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/pdfoptim
- Size: 21.5 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- Contributing: contributing.md
- License: license
- Code of conduct: code_of_conduct.md
Awesome Lists containing this project
README
# pdfoptim [](https://travis-ci.com/rodrigobdz/pdfoptim)
> Optimize file size of PDFs
## Install
```sh
$ npm install pdfoptim
```
## Usage
```js
const pdfoptim = require('pdfoptim');
pdfoptim('printer-manual.pdf');
// Filesize difference -79.46% ✂️
// Optimized version of printer-manual.pdf saved as optimized-1556039930343.pdf 🎉
```
## API
### pdfoptim(filePath, [options])
#### filePath
Type: `string`
Path to PDF file to optimize.
#### options
Type: `Object`
##### outputFile
Type: `string`
Default: `optimized-{timestamp}.pdf`
Filename for optimized PDF.
## CLI
```sh
$ npm install --global pdfoptim
```
```sh
$ pdfoptim --help
Usage
pdfoptim [filePath]
Options
--outputFile File name for optimized PDF [Default: optimized-{timestamp}.pdf
Examples
$ pdfoptim essay.pdf
// Optimized PDF created with name optimized-[timestamp].pdf
$ pdfoptim -o optim-essay.pdf essay.pdf
// Optimized PDF created with name essay-optim.pdf
```
## Credits
* [percentage-diff](https://github.com/rodrigobdz/percentage-diff) - Calculate percentage difference between two numbers
* [generator-lnm](https://github.com/rodrigobdz/generator-lnm) - Awesome node module generator
## License
[MIT](license) © [Rodrigo Bermudez Schettino](https://rodrigobdz.github.io)