summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--printer.cpp3
-rw-r--r--qt-ui/printoptions.h1
-rw-r--r--templatelayout.h2
3 files changed, 6 insertions, 0 deletions
diff --git a/printer.cpp b/printer.cpp
index 635778042..115b17526 100644
--- a/printer.cpp
+++ b/printer.cpp
@@ -3,6 +3,7 @@
#include "statistics.h"
#include "helpers.h"
+#include <algorithm>
#include <QtWebKitWidgets>
#include <QPainter>
#include <QWebElementCollection>
@@ -150,6 +151,8 @@ void Printer::print()
pageSize.setWidth(printerPtr->pageRect(QPrinter::Inch).width() * dpi);
webView->page()->setViewportSize(pageSize);
webView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
+ // export border width with at least 1 pixel
+ templateOptions->border_width = std::max(1, pageSize.width() / 1000);
webView->setHtml(t.generate());
if (printOptions->color_selected && printerPtr->colorMode()) {
printerPtr->setColorMode(QPrinter::Color);
diff --git a/qt-ui/printoptions.h b/qt-ui/printoptions.h
index aff8ed1d9..24f8e4cc8 100644
--- a/qt-ui/printoptions.h
+++ b/qt-ui/printoptions.h
@@ -19,6 +19,7 @@ struct print_options {
struct template_options {
int font_index;
int color_palette_index;
+ int border_width;
double font_size;
double line_spacing;
struct color_palette_struct {
diff --git a/templatelayout.h b/templatelayout.h
index 07e3ae060..41a3cbfa9 100644
--- a/templatelayout.h
+++ b/templatelayout.h
@@ -151,6 +151,8 @@ if (property == "font") {
case 4:
return "Verdana, Geneva, sans-serif";
}
+} else if (property == "borderwidth") {
+ return object.border_width;
} else if (property == "font_size") {
return object.font_size / 9.0;
} else if (property == "line_spacing") {