Version: 0.5.1 (using KDE 3.5.1, Debian Package 4:3.5.1-4 (testing/unstable)) Compiler: Target: i486-linux-gnu OS: Linux (i686) release 2.6.15.6 When manually setting margins in print -> properties, KPDF ignores them. I have some PDF documents with too short margins, so the text on the border is eaten. How to reproduce : - Open PDF file (in kpdf or konqui's kpdf part) - Print -> Properties -> Margins - Set big margins (e.g. 6cm) - Click OK - Check preview and hit "print" Also, margins are never saved. When I come back into the margins dialog, "use personalized margins" is checked and all margins are set to 0. Note that I tried the same with konqui/khtml and it works fine, including saving the margins.
I see the same thing, running on Fedora Core 4. Margin settings appear to be applied in the tab, and appear to be saved. But when you print the margins are not being applied, and after printing when you open the dialog tab again the custom margin values have been reset to 0 again. KDF 0.5.3
I have the same problem as well: kpdf 3.5.4-0ubuntu2
I can confirm that this is still an issue with KPDF 0.5.5 (Gentoo). Other KDE applications honor and save the margins correctly.
*** Bug 131990 has been marked as a duplicate of this bug. ***
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
ooooh... i was battling this problem for quite some time and was not sure whether it's me, ppd file or whatnot... thanks for this fix. in which kde version could we see this ?
Should be there with KDE 3.5.6