You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
3.0 KiB
HTML

5 years ago
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tasks of the Contingent Librarian</title>
<link rel="stylesheet" type="text/css" href="tasks.css">
<script src="tasks.js"></script>
</head>
<body>
<div class="card"><DOCUMENT_FRAGMENT><div class="mw-parser-output"><h2><span class="mw-headline" id="booklet.sh_for_PDF_imposition_into_a_booklet">booklet.sh for PDF imposition into a booklet</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/mw-mediadesign/index.php?title=User:Simon/Trim4/Michaels_booklet_script_for_PDF_imposition&amp;action=edit&amp;section=1" title="Edit section: booklet.sh for PDF imposition into a booklet">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<p>I found another way to do imposition using a script Michael wrote called booklet.sh, downloadable here: <a class="external free" href="https://git.xpub.nl/murtaugh/95layouts" rel="nofollow">https://git.xpub.nl/murtaugh/95layouts</a><br>
It's a shell script that can run in the bin folder from the home directory, which allows you to run it wherever you are in the computer - you don't have to <code>cd</code> to the folder where the script is. To enable this, first you have to echo the path for the bin folder that the scripts are in. The command to run it from the terminal is:
</p>
<pre>booklet.sh source.pdf
</pre>
<p>It needs a few dependencies to run (mainly psutils).
</p>
<ol><li>Requirements: psutils, pdftk, python3 with reportlab (make_blank_pdf.py)</li></ol>
<pre>input=$1
base=${input%.*}
echo converting $input to $base.booklet.pdf
pdftk_utils.py $input pad --multiple 4 --output $base.01.pdf
pdftops -paper match $base.01.pdf $base.01.ps
psbook -s`pdftk_utils.py $base.01.pdf count` $base.01.ps $base.02.ps
psnup -2 -PA4 $base.02.ps $base.03.ps
ps2pdf $base.03.ps $base.booklet.pdf
rm $base.01.pdf $base.01.ps $base.02.ps $base.03.ps
</pre>
<p>Note: Comment out or delete the last line to produce three .ps files - the first one is the source PDF, the second is the PDF imposed in the correct order, the third one is the imposed PDF pages on an A4 page. This works well if all you want to do is impose, print and fold. For cutting sheets you need to position the pages 2-up, centred on the page, which I can't quite figure out how to do...
</p>
<!--
NewPP limit report
Cached time: 20200609143240
Cache expiry: 86400
Dynamic content: false
CPU time usage: 0.008 seconds
Real time usage: 0.009 seconds
Preprocessor visited node count: 8/1000000
Preprocessor generated node count: 48/1000000
Postexpand include size: 0/2097152 bytes
Template argument size: 0/2097152 bytes
Highest expansion depth: 2/40
Expensive parser function count: 0/100
Unstrip recursion depth: 0/20
Unstrip postexpand size: 419/5000000 bytes
-->
<!--
Transclusion expansion time report (%,ms,calls,template)
100.00% 0.000 1 -total
-->
<!-- Saved in parser cache with key wdka_mw_mediadesign-mw_:pcache:idhash:31636-0!canonical and timestamp 20200609143240 and revision id 173561
-->
</div></DOCUMENT_FRAGMENT></div>
</body>
</html>