Hi All,

I am using qt-embedded-4.5 on linux and qt 4.5 on window.
I have written the following code for printing on window and embedded linux (kernel 2.6.27).
Following code is not able to detect the printer on Linux but it is working on windows.

And I have tested printer manualy on Linux
like
USB printer is detected in directory /dev/usb/lp0.

using cat/echo command it is possible to print the file and text.
cat file > /dev/usb/lp0



What could be the problem?

Thanks for giving your valuable time.


QPrinter printer;
QPrintDialog dlg( &printer );
if( dlg.exec() == QDialog::Accepted )
{
QPainter painter( &printer );

painter.setPen( Qt::black );

for( int page=0; page<5; page++ )
{
painter.drawRect( printer.pageRect() );
painter.drawLine( printer.pageRect().topLeft(), printer.pageRect().bottomRight() );
painter.drawLine( printer.pageRect().topRight(), printer.pageRect().bottomLeft() );

QRectF textArea(
printer.pageRect().left() +printer.resolution() * 0.5,
printer.pageRect().top() +printer.resolution() * 0.5,
printer.pageRect().width() -printer.resolution() * 1.0,
printer.pageRect().height()-printer.resolution() * 1.5 );

painter.drawRect( textArea );

painter.drawText( textArea, Qt::AlignTop | Qt::AlignLeft, QString( "Page %1" ).arg( page+1 ) );

if( page != 4 )
printer.newPage();
}
}