Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.

Commit b224feb

Browse files
committed
make it possible to set printing margins separately
1 parent bbce892 commit b224feb

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/webpage.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,15 @@ bool WebPage::renderPdf(const QString &fileName)
525525

526526
const qreal border = paperSize.contains("border") ?
527527
floor(stringToPointSize(paperSize.value("border").toString())) : 0;
528-
printer.setPageMargins(border, border, border, border, QPrinter::Point);
528+
const qreal borderBottom = paperSize.contains("borderBottom") ?
529+
floor(stringToPointSize(paperSize.value("borderBottom").toString())) : border;
530+
const qreal borderTop = paperSize.contains("borderTop") ?
531+
floor(stringToPointSize(paperSize.value("borderTop").toString())) : border;
532+
const qreal borderLeft = paperSize.contains("borderLeft") ?
533+
floor(stringToPointSize(paperSize.value("borderLeft").toString())) : border;
534+
const qreal borderRight = paperSize.contains("borderRight") ?
535+
floor(stringToPointSize(paperSize.value("borderRight").toString())) : border;
536+
printer.setPageMargins(borderLeft, borderTop, borderRight, borderBottom, QPrinter::Point);
529537

530538
m_mainFrame->print(&printer);
531539
return true;

0 commit comments

Comments
 (0)