You need to prevent clipping yourself. The printing mechanism in Qt3
doesn't do much for you (I think Qt4 may be better in this regard.)

Determine the height of the text you are printing and only print as
much as will not clip.


On 7/26/05, Sheraz wrote:
> Hello
> =


> I have to print RichText (WYSIWYG) style Text Data..
> I am using QSimpleRichText with Printer as specified
> in Qt Example comes with installation..
> //all are aware of follwing Qt Example
> =


> =


> if ( printer.setup(this) ) // printer dialog
> {
> QPainter p;
> if( !p.begin( &printer ) ) { //
> paint on printer
> return;
> }
> =


> QPaintDeviceMetrics metrics( p.device() );
> int dpiy =3D metrics.logicalDpiY();
> int margin =3D (int) ( (2/2.54)*dpiy ); // 2 cm
> margins
> =


> QRect body( margin, margin, metrics.width() -
> 2*margin, metrics.height()- 2*margin );
> =


> QSimpleRichText richText( csPrintData,QFont(),
> e->context(),
> e->styleSheet(),
> e->mimeSourceFactory(),
> body.height() );
> =


> richText.setWidth( &p, body.width() );
> =


> =


> QRect view( body );
> int page =3D 1;
> do {
> richText.draw( &p, body.left(),
> body.top(), view, colorGroup() );
> view.moveBy( 0, body.height() );
> p.translate( 0 , -body.height() );
> p.drawText( view.right() -
> p.fontMetrics().width( QString::number( page ) ),
> view.bottom() +
> p.fontMetrics().ascent() - 5, QString::number( page )
> );
> if ( view.top() >=3D richText.height() )
> break;
> printer.newPage();
> page++;
> } while (TRUE);
> }
> =


> =


> And By using this I am facing an Annoying Clipping
> Text Problem During Print...
> Most of the time it prints correctly but when i play
> with text it size and style....as its a Rich Text...I
> can see Clipping text at the bottom of my first page
> or at the top of 2nd page.....
> =


> It is b.c Simpletext data is being picked for Printer
> as Image by defining QRect thing......
> =


> Any resolution to this problem ? Or any one has tried
> this before for proper rich text prints please help me
> ..
> =


> I have searched all the previous posts in this context
> but I all of the previous post relevant to this
> problem don't talk about solution.
> =


> Thanks in Advance =


> Sheraz
> =


> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around =


> http://mail.yahoo.com =


> =


> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscr=

ibe
> <<
>

=

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscrib=

e <<