Summary: | kpdf does not respect default kde paper settings | ||
---|---|---|---|
Product: | [Unmaintained] kpdf | Reporter: | Felix Kurth <felix> |
Component: | general | Assignee: | Albert Astals Cid <aacid> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Patch that may fix the page size problem
Second try to fix paper size problem |
Description
Felix Kurth
2005-02-22 14:52:25 UTC
True, the code that makes the print is not 100% correct, i'm working on that. Its not fixed in rc1. This bug is annoying, you should realy fix it before the 3.4 release. And you should be more polite. It is not going to be fixed for KDE 3.4.0 This prevents all non-letter users (even you ?) from printing with kpdf. I would call this a showstoper. But i don't have a working patch and KDE is not going to stop only for kpdf so it'll have to wait for KDE 3.4.1. I'll tell you how a dirty fix, create a file called /etc/xpdfrc and put inside of it psPaperSize A4 That will make kpdf print allways using A4 Well, i've found that it may not be that hard to fix, are you in position to try a patch? Created attachment 9875 [details]
Patch that may fix the page size problem
If you don't know how to apply a patch do not hesitate to ask
Does not work here. Patch applys fine, but it does not solve the problem. Created attachment 9876 [details]
Second try to fix paper size problem
Well, i did a big error as removed a line to make it look better and forgot to
add it :-(
Please try with this patch.
You're great man! It seems to work now. My printer doesnt complain now. Will do some further tests tomorow. Thank you very much. CVS commit by aacid: Print to the correct page size Olaf can you check that fixes your wrong paper format complaining printer too? CCMAIL: 98837@bugs.kde.org BUGS: 100003 M +24 -0 generator_pdf.cpp 1.23 --- kdegraphics/kpdf/core/generator_pdf/generator_pdf.cpp #1.22:1.23 @@ -14,4 +14,6 @@ #include <qimage.h> #include <qapplication.h> +#include <qpaintdevicemetrics.h> +#include <qregexp.h> #include <klocale.h> #include <kpassdlg.h> @@ -297,4 +299,26 @@ void PDFGenerator::generateSyncTextPage( bool PDFGenerator::print( KPrinter& printer ) { + QString ps = printer.option("PageSize"); + 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()); + } + else + { + // size is supported by Qt, we get either the pageSize name or nothing because the default pageSize is used + QPrinter dummy(QPrinter::PrinterResolution); + dummy.setFullPage(true); + dummy.setPageSize((QPrinter::PageSize)(ps.isEmpty() ? KGlobal::locale()->pageSize() : pageNameToPageSize(ps))); + + QPaintDeviceMetrics metrics(&dummy); + globalParams->setPSPaperWidth(metrics.width()); + globalParams->setPSPaperHeight(metrics.height()); + } + KTempFile tf( QString::null, ".ps" ); PSOutputDev *psOut = new PSOutputDev(tf.name().latin1(), pdfdoc->getXRef(), pdfdoc->getCatalog(), 1, pdfdoc->getNumPages(), psModePS); |