Important: Please read the Qt Code of Conduct -

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.setOutputFormat( QPrinter::PdfFormat );
    printer.setOutputFileName( theOutputFileName );
    QPainter painter;
    painter.begin( &printer );
    foreach( QString fileName, theImagePathList ){
    QImage imgObj( fileName );
    printer.setPaperSize( QSizeF(imgObj.width(), imgObj.height()), QPrinter::DevicePixel );
    painter.drawImage( 0, 0, imgObj );

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

Log in to reply