Is it possible to make a pdf with different page size?



  • If the size of the page is same, then no problem, but I need the page size should be the size of Image(which is variable),
    @
    void DgJpgToPdf::convertToPdf( const QStringList& theImagePathList, const QString& theOutputFileName )
    {
    QPrinter printer;
    printer.setOrientation(QPrinter::Portrait);
    printer.setOutputFormat( QPrinter::PdfFormat );
    printer.setOutputFileName( theOutputFileName );
    QPainter painter;
    painter.begin( &printer );
    //printer.newPage();
    foreach( QString fileName, theImagePathList ){
    QImage imgObj( fileName );
    printer.setPaperSize( QSizeF(imgObj.width(), imgObj.height()), QPrinter::DevicePixel );
    painter.drawImage( 0, 0, imgObj );
    printer.newPage();
    }
    painter.end();
    }
    @

    its giving me a pdf with first page ok. but the next pages contains some distorted images.
    please help?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.