Commit faf7eb70 authored by Radek Hušek's avatar Radek Hušek
Browse files

add Crop option

parent 25402284
......@@ -80,6 +80,38 @@ class CPP(QWidget):
o.setWordWrap(True)
vbox.addWidget(o)
def margin_spinbox(name, layout):
hbox = QHBoxLayout()
hbox.addWidget(QLabel(name))
s = QSpinBox(self)
s.setMinimum(0)
s.setMaximum(100)
s.setSingleStep(1)
s.setValue(20)
s.setEnabled(False)
hbox.addWidget(s)
layout.addLayout(hbox)
return s
hbox = QHBoxLayout()
self._crop = QCheckBox('Crop', self)
hbox.addWidget(self._crop)
_vbox = QVBoxLayout()
_vbox.addWidget(QLabel("Margins [mm]"))
self._crop_margin = (
margin_spinbox("Left", _vbox),
margin_spinbox("Top", _vbox),
margin_spinbox("Right", _vbox),
margin_spinbox("Bottom", _vbox),
)
hbox.addLayout(_vbox)
vbox.addLayout(hbox)
def _crop_changed(checked):
for m in self._crop_margin:
m.setEnabled(checked)
self._crop.clicked[bool].connect(_crop_changed)
hbox = QHBoxLayout()
self._compact = QCheckBox('Compact', self)
self._compact_copies = QSpinBox(self)
......@@ -167,6 +199,13 @@ class CPP(QWidget):
log.append(msg)
self._logger.setPlainText("".join(log))
MM_TO_BP = 2.83465
if self._crop.isChecked():
margin = " ".join([ "%d" % (MM_TO_BP * m.value()) for m in self._crop_margin ])
pipeline.append([ "%s/pdfcrop_wrapper.sh" % DIR,
"--margin", margin, "-", "/dev/stdout" ])
if self._pdfbook.isChecked():
pipeline.append([ "pdfbook", "/dev/stdin", "-o", "/dev/stdout" ])
......
#!/bin/bash
cd /tmp
exec pdfcrop "$@"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment