Unsolved Poppler-Qt5 Failing to render to qpainter
-
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?