Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Radek Hušek
cups-pdf-postprocess
Commits
faf7eb70
Commit
faf7eb70
authored
Oct 10, 2017
by
Radek Hušek
Browse files
add Crop option
parent
25402284
Changes
2
Hide whitespace changes
Inline
Side-by-side
cups-pdf-postprocess.py
View file @
faf7eb70
...
...
@@ -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"
])
...
...
pdfcrop_wrapper.sh
0 → 100755
View file @
faf7eb70
#!/bin/bash
cd
/tmp
exec
pdfcrop
"
$@
"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment