日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

pdf切割软件linux,linux下的pdf分割软件

發(fā)布時間:2024/1/1 linux 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 pdf切割软件linux,linux下的pdf分割软件 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

想把PDF文件放在手機里看,但手機中的軟件限制了500K的文件大小,無奈啊。

找找linux下的pdf處理軟件吧。

今天找到了pdftk的軟件,不僅僅可以分割PDF文件。可以上他的網(wǎng)頁上看看去。

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的腳本路徑一般情況下應(yīng)該在/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腳本,可以自己設(shè)定項,自動分割,默認情況下每一個分割后的文件為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

總結(jié)

以上是生活随笔為你收集整理的pdf切割软件linux,linux下的pdf分割软件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。