[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-i18n-doc
Subject: branches/KDE/3.5/kdegraphics/kpdf
From: Albert Astals Cid <tsdgeos () terra ! es>
Date: 2006-11-17 22:15:34
Message-ID: 1163801734.931692.25142.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 605710 by aacid:
Fix kpdf ignoring user defined margins when printing
@translators, it introduces a four new messages, hope it's ok for you, if not please \
shout and i will revert the change.
BUGS: 124192
CCMAIL: kde-i18n-doc@kde.org
M +27 -5 core/generator_pdf/generator_pdf.cpp
M +0 -2 part.cpp
--- branches/KDE/3.5/kdegraphics/kpdf/core/generator_pdf/generator_pdf.cpp \
#605709:605710 @@ -409,14 +409,21 @@
bool PDFGenerator::print( KPrinter& printer )
{
QString ps = printer.option("PageSize");
+ int paperWidth, paperHeight;
+ int marginTop, marginLeft, marginRight, marginBottom;
+ marginTop = (int)printer.option("kde-margin-top").toDouble();
+ marginLeft = (int)printer.option("kde-margin-left").toDouble();
+ marginRight = (int)printer.option("kde-margin-right").toDouble();
+ marginBottom = (int)printer.option("kde-margin-bottom").toDouble();
+
if (ps.find(QRegExp("w\\d+h\\d+")) == 0)
{
// size not supported by Qt, KPrinter gives us the size as wWIDTHhHEIGHT
// remove the w
ps = ps.mid(1);
int hPos = ps.find("h");
- globalParams->setPSPaperWidth(ps.left(hPos).toInt());
- globalParams->setPSPaperHeight(ps.mid(hPos+1).toInt());
+ paperWidth = ps.left(hPos).toInt();
+ paperHeight = ps.mid(hPos+1).toInt();
}
else
{
@@ -426,17 +433,32 @@
dummy.setPageSize((QPrinter::PageSize)(ps.isEmpty() ? \
KGlobal::locale()->pageSize() : pageNameToPageSize(ps)));
QPaintDeviceMetrics metrics(&dummy);
- globalParams->setPSPaperWidth(metrics.width());
- globalParams->setPSPaperHeight(metrics.height());
+ paperWidth = metrics.width();
+ paperHeight = metrics.height();
}
KTempFile tf( QString::null, ".ps" );
- PSOutputDev *psOut = new PSOutputDev(tf.name().latin1(), pdfdoc->getXRef(), \
pdfdoc->getCatalog(), 1, pdfdoc->getNumPages(), psModePS); + \
globalParams->setPSPaperWidth(paperWidth); + \
globalParams->setPSPaperHeight(paperHeight); + PSOutputDev *psOut = new \
PSOutputDev(tf.name().latin1(), pdfdoc->getXRef(), pdfdoc->getCatalog(), 1, \
pdfdoc->getNumPages(), psModePS, marginRight, marginBottom, paperWidth - marginLeft, \
paperHeight - marginTop);
if (psOut->isOk())
{
std::list<int> pages;
+ double xScale = ((double)paperWidth - (double)marginLeft - \
(double)marginRight) / (double)paperWidth; + double yScale = \
((double)paperHeight - (double)marginBottom - (double)marginTop) / \
(double)paperHeight; +
+ if ( abs((int)(xScale * 100) - (int)(yScale * 100)) > 5 ) {
+ int result = KMessageBox::questionYesNo(0,
+ i18n("The margins you specified are changing \
the page aspect ratio. Do you want to print with the aspect ratio changed or do you \
want the margins to be adapted so that aspect ratio is preserved?"), + \
i18n("Aspect ratio change"), + i18n("Print with \
specified margins"), + i18n("Print adapting \
margins to keep aspect ratio"), + \
"kpdfStrictlyObeyMargins"); + if (result == KMessageBox::Yes) \
psOut->setScale(xScale, yScale); + }
+
if (!printer.previewOnly())
{
QValueList<int> pageList = printer.pageList();
--- branches/KDE/3.5/kdegraphics/kpdf/part.cpp #605709:605710
@@ -791,7 +791,6 @@
printer.setMinMax(1, m_document->pages());
printer.setPreviewOnly( true );
- printer.setMargins(0, 0, 0, 0);
// if some pages are landscape and others are not the most common win as \
kprinter does // not accept a per page setting
@@ -923,7 +922,6 @@
printer.setPageSelection(KPrinter::ApplicationSide);
printer.setMinMax(1, m_document->pages());
printer.setCurrentPage(m_document->currentPage()+1);
- printer.setMargins(0, 0, 0, 0);
// if some pages are landscape and others are not the most common win as \
kprinter does // not accept a per page setting
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic