• R/O
  • SSH

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂20ccb5873c473ac5169176c0abc726ac68dae325 (tree)
時間2020-11-18 20:35:05
作者Lorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

A script to remove only the top and bottom margins of a pdf.

Change Summary

差異

diff -r ca060a8ae1e3 -r 20ccb5873c47 Bash-scripts/remove_top_bottom_margin.bash
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Bash-scripts/remove_top_bottom_margin.bash Wed Nov 18 12:35:05 2020 +0100
@@ -0,0 +1,11 @@
1+#!/bin/bash
2+fname="$1"
3+pagesize=( $(pdfinfo "$fname" | grep "Page size" | cut -d ":" -f2 | \
4+ awk '{ print $1,$3 }') )
5+bounding=( $(pdfcrop --verbose "$fname" | grep "%%HiResBoundingBox" | \
6+ cut -d":" -f2 ) )
7+rm "${fname//.pdf/-crop.pdf}"
8+lmarg="${bounding[0]}"
9+rmarg="$(python -c "print(${pagesize[0]} - ${bounding[2]})")"
10+pdfcrop --margins "$lmarg 0 $rmarg 0" "$fname" "$fname"
11+