Thursday, November 3, 2011

Pdf Merge

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf


Unless you're very familiar with Ghostscript, that string of commands won't mean much to you. Here's a quick breakdown:
    \t
  • gs -- starts the Ghostscript program
  • \t
  • -dBATCH -- once Ghostscript processes the PDF files, it should exit. If you don't include this option, Ghostscript will just keep running
  • \t
  • -dNOPAUSE -- forces Ghostscript to process each page without pausing for user interaction
  • \t
  • -q -- stops Ghostscript from displaying messages while it works
  • \t
  • -sDEVICE=pdfwrite -- tells Ghostscript to use its built-in PDF writer to process the files
  • \t
  • -sOutputFile=finished.pdf -- tells Ghostscript to save the combined PDF file with the name that you specified

https://www.linux.com/news/software/applications/8229-putting-together-pdf-files

split pdf using GS:

#!/bin/sh
#
# pdfsplit [input.pdf] [first_page] [last_page] [output.pdf] 
#
# Example: pdfsplit big_file.pdf 10 20 pages_ten_to_twenty.pdf
#
# written by: Westley Weimer, Wed Mar 19 17:58:09 EDT 2008
#
# The trick: ghostscript (gs) will do PDF splitting for you, it's just not
# obvious and the required defines are not listed in the manual page. 

if [ $# -lt 4 ] 
then
        echo "Usage: pdfsplit input.pdf first_page last_page output.pdf"
        exit 1
fi
gs -dNOPAUSE -dQUIET -dBATCH -sOutputFile="$4" -dFirstPage=$2 -dLastPage=$3 -sDEVICE=pdfwrite "$1"

gs -dNOPAUSE -dQUIET -dBATCH -sOutputFile=out.pdf -dFirstPage=1 -dLastPage=1 -sDEVICE=pdfwrite Conflict_interest.pdf



https://stackoverflow.com/questions/10228592/splitting-a-pdf-with-ghostscript

No comments:

Post a Comment