pdf切割软件linux,linux下的pdf分割软件
想把PDF文件放在手機里看,但手機中的軟件限制了500K的文件大小,無奈啊。
找找linux下的pdf處理軟件吧。
今天找到了pdftk的軟件,不僅僅可以分割PDF文件。可以上他的網頁上看看去。
http://www.accesspdf.com/pdftk/
更妙的是,從這個頁中還看到了VIM的PDF插件,偷著樂吧。
Vim users can also install my plug-in for easily editing PDF code. When you open a PDF in Vim, the plug-in calls pdftk to uncompress the page streams, so they are editable. When you save the PDF, the plug-in uses pdftk to repair and re-compress the PDF.
Download pdftk.vim.zip , unpack, and then move pdftk.vim into your Vim plug-ins directory (e.g., C:/vim/vim63/plugin ). Restart Vim to source the new plug-in.
太懶了,不翻譯了。有需要的可以自己去看。
看來寫插件的那個家伙是在windows下用的,如果你用的是linux,vim的腳本路徑一般情況下應該在/usr/share/vim/vim72/plugin
下面寫一個分割的例子
pdftk A=ARM-Architecture-Reference-Manual-v5-and-v6.pdf? cat A39-108 output 1.pdf
A=表是要分割的PDF文件名
cat 后跟A39-108表示從39頁到108頁需要分割
output表示輸出的那些頁, 后面跟輸出的文件名。
我自己寫了個bash腳本,可以自己設定項,自動分割,默認情況下每一個分割后的文件為50頁。
#!/bin/bash
IN=$1
#How many pages when you want to cut?
M=50
if [ -z $IN ]; then
echo "You must follow the pdf document after the command."
echo "Usage ./cut file.pdf"
echo "The test script it exit now."
exit 1
fi
which pdftk > pdftk.txt
if [ ! -s pdftk.txt ]; then
echo "The program pdftk is not installed, you should install it first."
echo "The test script it exit now."
rm pdftk.txt
exit 1
else
rm pdftk.txt
fi
INPUT=${IN%${IN: -4}}
if [ ! -d $INPUT ]; then
mkdir $INPUT
fi
pdftk $IN dump_data output ./$INPUT/report.txt
PAGE=`grep NumberOfPages ./$INPUT/report.txt`
PAGE=`echo $PAGE | cut -f 2 -d: `
for((i=1,j=1,k=1; i<=$PAGE; i++,j++,k++))
do
j=$(expr /( $i + $M - 1 /));
if [ $j -lt $PAGE ]; then
pdftk A=$IN cat A$i-$j output ./$INPUT/$k.pdf
else
pdftk A=$IN cat A$i-$PAGE output ./$INPUT/$k.pdf
fi
i=$(expr /( $i + $M - 1 /));
done
rm -rf ./$INPUT/report.txt
總結
以上是生活随笔為你收集整理的pdf切割软件linux,linux下的pdf分割软件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 拼多多新入驻店铺一般多久能出单?
- 下一篇: android maxlength 汉字