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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值