0

I'm making PDF viewer using qt and poppler library but, the error occurred running this program

error was 'The program has unexpectedly finished.'
error occur Poppler::Document* document = Poppler::Document::load(filename);


When I erase Poppler::Document::load(filename) error not occurred
How to solve it?

I found an error code below but follow this example poppler Qt5

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <opencv2/opencv.hpp>
#include <QFileDialog>
#include <QMessageBox>
#include <QDesktopServices>
#include <QUrl>
#include <poppler-qt5.h>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    cv::Mat image = cv::imread("/home/googolhkl/사진/IMG_20150925_1.jpg");
    cv::imshow("display",image);

    QString filename;
    Poppler::Document* document = Poppler::Document::load(filename);
    if (!document || document->isLocked()) {
      // ... error message ....
      delete document;
      return;
    }
}
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
이경훈
  • 39
  • 1
  • 4

1 Answers1

0

You have to load existing file, but in your example the file name is empty:

QString filename;
AnatolyS
  • 4,249
  • 18
  • 28