Skip to content

Option to remove blank pages when importing documents #668

Closed Locked Answered by psi-4ward
tobire asked this question in Feature Requests
Discussion options

You must be logged in to vote

Hi Mates,

I use the docker-setup would like to give u brief overview of my solution:

  1. Created a directory scripts nearby the docker-compose.yaml
  2. Added - ./scripts:/scripts:ro to the volumes: section of paperless
  3. Added the PAPERLESS_PRE_CONSUME_SCRIPT=/scripts/pre-consume.sh to the environment (ie env-file or environment block in docker-compose.yaml)
  4. Added scripts/pre-consume.sh with
    #!/bin/sh
    set -x
    
    # Remove blank pages
    /scripts/remove-blank-pages.sh
  5. Added scripts/remove-blank-pages.sh
    #!/bin/bash
    set -e -o pipefail
    export LC_ALL=C
    
    #IN="$1"
    IN="$DOCUMENT_WORKING_PATH"
    
    PAGES=$(pdfinfo "$IN" | grep ^Pages: | tr -dc '0-9')
    THRESHOLD=0.002
    
    non_blank() {
      for i in $(seq 1 $PAGES) ; do

Replies: 14 comments 46 replies

Comment options

You must be logged in to vote
1 reply
@koseduhemak
Comment options

Comment options

You must be logged in to vote
20 replies
@psi-4ward
Comment options

@stnieder
Comment options

@KelvinGradCelsius
Comment options

@christi-ko
Comment options

@Sectorchan
Comment options

Answer selected by stumpylog
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
8 replies
@felixgonschorek
Comment options

@Ben-Bitdiddle-DE
Comment options

@Ben-Bitdiddle-DE
Comment options

@Ben-Bitdiddle-DE
Comment options

@felixgonschorek
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
13 replies
@Dtrieb
Comment options

@Ben-Bitdiddle-DE
Comment options

@Dtrieb
Comment options

@Ben-Bitdiddle-DE
Comment options

@ciB89
Comment options

Comment options

You must be logged in to vote
1 reply
@Ben-Bitdiddle-DE
Comment options

Comment options

You must be logged in to vote
2 replies
@rurcoasteagle
Comment options

@christi-ko
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Sectorchan
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet