Qt World Summit: Register Today!

QPrinter creates blurred PDFs in arm target machine

  • Hi ,
    I'm using Qt in 32 bit Ubuntu as well as ARM platform.

    Below is the version details
    Ubuntu 32 bit
    Qt 4.8.4
    libQtWebKit.so -> libQtWebKit.so.4.9.3

    Ti AM335x arm
    Qt 4.8.4
    libQtWebKitE.so -> libQtWebKitE.so.4.9.3

    I'm converting HTML data to PDF using Qwebview and Qprinter using below pseduo code.

    pWebview ->setHtml( QString::fromUtf8( pHtmlIn ) );
    pWebview ->setZoomFactor( 1 );
    outFile = QString::fromUtf8( pPdfOutFile );
    pQtPrinter ->setResolution( 300 );
    pQtPrinter ->setOutputFormat( QPrinter::PdfFormat );
    pQtPrinter ->setPaperSize( QPrinter::A4 );
    pQtPrinter ->setOutputFileName( outFile );

    // Print to pdf file
    pWebview ->print( pQtPrinter ) ;

    In Ubuntu it generates good quality PDFs while in arm target it gets distorted.

    Ubuntu Output:- https://akhilm.sharefile.com/d-sf4328a26cd247a28
    Arm output:- https://akhilm.sharefile.com/d-sf3ca019dd934e4db

    Please share your thoughts on why there is considerable difference in quality.
    Can I improve it by changing code, if so please share that too..

    Thanks for your help

  • Any thoughts on this ?


  • maybe you don´t have the needed fonts installed on your arm platform

  • I think it's obvious from pictures that pages have different scale, it's probably caused by different screen resolution on device. Try setting Qt::AA_Use96Dpi attribute on QApplication.

  • @sneubert Sorry for the delay in response.. I was caught up with some other work.
    I copied same fonts to both target and ubuntu. But I observed some inconsistency in the fonts used in pdf output.

    Ubuntu PDF output:-
    $pdffonts print.pdf
    name type emb sub uni object ID

    FreeSansBold CID TrueType yes no yes 7 0
    FreeSans CID TrueType yes no yes 8 0
    FreeSansOblique CID TrueType yes no yes 54 0

    Target PDF output:-
    name type emb sub uni object ID

    FreeSans-0-75 CID TrueType yes no yes 7 0
    FreeSans-0-50 CID TrueType yes no yes 8 0
    FreeSans-1-50 CID TrueType yes no yes 84 0

    Both font names are a bit different.
    Can this throw any lights on how I can make both fonts same ?
    Your help is highly appreciated..


  • @Konstantin-Tokarev Sorry for the delayed response.. Qt 4.8 doesn't support this attribute.


Log in to reply