Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Poppler-Qt5 Failing to render to qpainter
Qt 6.11 is out! See what's new in the release blog

Poppler-Qt5 Failing to render to qpainter

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 609 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Akito_KamiA Offline
    Akito_KamiA Offline
    Akito_Kami
    wrote on last edited by
    #1

    I'm prototyping a basic function to paint page 1 of a pdf to QGraphicsView using this class

    void MainWindow::PDF(){
        QString path = "D:\\Translation.pdf";
        Poppler::Document *doc = Poppler::Document::load(path);
        Poppler::Page* pdfPage1 = doc->page(0);
        Poppler::Page* pdfPage2 = doc->page(1);
        //QImage image = pdfPage->renderToImage(1080,1080,-1,-1,-1,-1);
        QPixmap *pix = new QPixmap(1080,1080);
        QPainter *paint1 = new QPainter(pix);
        if (pdfPage1->renderToPainter(paint1 ,1080,1080,-1,-1,-1,-1)){
            qDebug() << true;
        }
        else{
            qDebug() << false;
        }
        QGraphicsScene *scene = new QGraphicsScene();
        scene->addPixmap(*pix);
        ui->graphicsView->setScene(scene);
    }
    

    Right now when ever it tries to paint,, it always prints out false. How do I get this to paint without fail?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved