Giter VIP home page Giter VIP logo

pdf-compressor's Introduction

pdf-compressor

Compress PDF file's pages and size.

Introduction

A light-weight tool to compress PDF file's pages and size. The compressing loses origin file's format, only the text information is saved in the compressed result.

With default font size 10, the compressing effect looks like:

$ python main.py -i input.pdf
File size (KB):         15114.015----> 45.828
Page count:             23 --------> 15

By setting the font size smaller to 5:

$ python main.py -i input.pdf -f 5
File size (KB):         15114.015----> 31.638
Page count:             23 --------> 4

Below is a glance of the process, from left to right: origin file -> compressed file -> compressed file with font size 5.

Requirements

In Python 3.X envrionment, install reqirements by pip install -r requirements.txt

Usage

  1. Clone the repository, put PDF file(s) to ./files folder. python main.py -h to check arguments' meanings.
  2. One typical usage command is:
    python main.py -i input.pdf
    
  3. The output file is saved to ./files folder with name ending _compressed.pdf

Below lists all arguments meaning:

'-b', '--base-path', default='./files', type=str, help='Base path to the PDF files for processing'
'-i', '--input-files', required=True, nargs='+', help="Input PDF files name(s), add space between two files"
'-f', '--font-size', default=10, help="Font size of the output PDF"

Additions

  • Open an issue if you meet problem, considering star the project if it helps. Thanks for your contributions!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.