[PATCH] KPDF - Print with the correct page size
Albert Astals Cid
astals11 at terra.es
Mon Feb 28 08:35:02 GMT 2005
A Dilluns 28 Febrer 2005 01:01, David Faure va escriure:
> On Monday 28 February 2005 00:09, Albert Astals Cid wrote:
> > Hi, i think that may be a candidate to commit to KDE_3_4_BRANCH.
> >
> > The problem lies in that kpdf was not setting the pagesize of what it was
> > printing according to what KPrinter said, instead it was printing the
> > page size specified in /etc/xpdfrc or Letter as default, this is
> > obviously wrong and that patch fixes it (at least the user that reported
> > the problem says it seems to work, i don't have different paper sizes to
> > try)
> >
> > Related bug: http://bugs.kde.org/show_bug.cgi?id=100003
> >
> > May i commit it to KDE_3_4_BRANCH?
>
> + QRegExp re = QRegExp("w\\d+h\\d+");
> + if (ps.find(QRegExp("w\\d+h\\d+")) == 0)
> should obviously by ps.find(re)
Ouch :-/
Of course it is either ps.find(re) or ps.find(QRegExp("w\\d+h\\d+"), is any of
the two better?
> + ps = ps.mid(1);
> + int hPos = ps.find("h");
> Hmm, OK. You could also have used capturing in the regexp :)
I've never used a regexp to capture anything so i thought it would be faster
to do that than learning how to capture in a QRegExp, is it much worse to use
that?
>
> But anyway - why use QPaintDeviceMetrics on a dummy printer instead of
> using it on "printer" itself (the argument to the method) ?
That is because doing paintDevice::width() and paintDevice::height() on the
argument of the method always returns the pageSize of A4 (default page size
here, calling pageSize() always return A4 too even when option("PageSize")
says otherwise), i would need to do setPageSize on "printer" as i do on the
dummy printer but i don't know if that would have side consequences so i
thought it would be safer to do it on a dummy printer and i don't see any bad
consequence.
Albert
More information about the kde-core-devel
mailing list