コード例 #1
1
ファイル: renderthread.cpp プロジェクト: KDE/cirkuit
void RenderThread::run()
{
    double factor = qBound(0.01, m_zoomFactor, 10.0);
            
    if (!QFile::exists(m_pdfUrl)) return;

    Poppler::Document* document = Poppler::Document::load(m_pdfUrl);
    if (!document || document->isLocked()) {
        delete document;
        return;
    }

    // Access page of the PDF file
    document->setRenderHint(Poppler::Document::Antialiasing, true);
    document->setRenderHint(Poppler::Document::TextAntialiasing, true);
    Poppler::Page* pdfPage = document->page(0);  // Document starts at page 0
    if (pdfPage == 0) {
        return;
    }

    // Generate a QImage of the rendered page
    QImage image = pdfPage->renderToImage(factor*200.0, factor*200.0);
    emit previewReady(image);
    
    delete pdfPage;
    delete document;
}
コード例 #2
1
ファイル: jsbridge.cpp プロジェクト: MidoriYakumo/hippo
int jsBridge::PDFpageCount(QString hash)
{
    Poppler::Document *doc = pdf->getDocument(hash);

    if (doc == NULL)
        return 0;
    return doc->numPages();
}
コード例 #3
0
void TestOptionalContent::checkNestedLayers()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/NestedLayers.pdf");
    QVERIFY( doc );

    QVERIFY( doc->hasOptionalContent() );

    Poppler::OptContentModel *optContent = doc->optionalContentModel();
    QModelIndex index;

    index = optContent->index( 0, 0, QModelIndex() );
    QCOMPARE( optContent->data( index, Qt::DisplayRole ).toString(), QString( "Black Text and Green Snow" ) );
    QCOMPARE( static_cast<Qt::CheckState>( optContent->data( index, Qt::CheckStateRole ).toInt() ), Qt::Unchecked );

    index = optContent->index( 1, 0, QModelIndex() );
    QCOMPARE( optContent->data( index, Qt::DisplayRole ).toString(), QString( "Mountains and Image" ) );
    QCOMPARE( static_cast<Qt::CheckState>( optContent->data( index, Qt::CheckStateRole ).toInt() ), Qt::Checked );

    // This is a sub-item of "Mountains and Image"
    QModelIndex subindex = optContent->index( 0, 0, index );
    QCOMPARE( optContent->data( subindex, Qt::DisplayRole ).toString(), QString( "Image" ) );
    QCOMPARE( static_cast<Qt::CheckState>( optContent->data( index, Qt::CheckStateRole ).toInt() ), Qt::Checked );

    index = optContent->index( 2, 0, QModelIndex() );
    QCOMPARE( optContent->data( index, Qt::DisplayRole ).toString(), QString( "Starburst" ) );
    QCOMPARE( static_cast<Qt::CheckState>( optContent->data( index, Qt::CheckStateRole ).toInt() ), Qt::Checked );

    index = optContent->index( 3, 0, QModelIndex() );
    QCOMPARE( optContent->data( index, Qt::DisplayRole ).toString(), QString( "Watermark" ) );
    QCOMPARE( static_cast<Qt::CheckState>( optContent->data( index, Qt::CheckStateRole ).toInt() ), Qt::Unchecked );

    delete doc;
}
コード例 #4
0
void TestAttachments::checkAttach2()
{

    Poppler::Document *doc;
    doc = Poppler::Document::load("../../../test/unittestcases/A6EmbeddedFiles.pdf");
    QVERIFY( doc );

    QVERIFY( doc->hasEmbeddedFiles() );

    QList<Poppler::EmbeddedFile*> fileList;
    fileList = doc->embeddedFiles();
    QCOMPARE( fileList.size(), 3 );

    Poppler::EmbeddedFile *embfile1 = fileList.at(0);
    QCOMPARE( embfile1->name(), QString("Acro7 thoughts") );
    QCOMPARE( embfile1->description(), QString("Acro7 Thoughts") );
    QCOMPARE( embfile1->createDate(), QDateTime( QDate( 2003, 8, 4 ), QTime( 13, 54, 54), Qt::UTC ) );
    QCOMPARE( embfile1->modDate(), QDateTime( QDate( 2003, 8, 4 ), QTime( 14, 15, 27), Qt::UTC ) );

    Poppler::EmbeddedFile *embfile2 = fileList.at(1);
    QCOMPARE( embfile2->name(), QString("acro transitions 1.xls") );
    QCOMPARE( embfile2->description(), QString("AcroTransitions") );
    QCOMPARE( embfile2->createDate(), QDateTime( QDate( 2003, 7, 18 ), QTime( 21, 7, 16), Qt::UTC ) );
    QCOMPARE( embfile2->modDate(), QDateTime( QDate( 2003, 7, 22 ), QTime( 13, 4, 40), Qt::UTC ) );

    Poppler::EmbeddedFile *embfile3 = fileList.at(2);
    QCOMPARE( embfile3->name(), QString("apago_pdfe_wide.gif") );
    QCOMPARE( embfile3->description(), QString("PDFE Animation") );
    QCOMPARE( embfile3->createDate(), QDateTime( QDate( 2003, 1, 31 ), QTime( 15, 54, 29), Qt::UTC ) );
    QCOMPARE( embfile3->modDate(), QDateTime( QDate( 2003, 1, 31 ), QTime( 15, 52, 58), Qt::UTC ) );

    delete doc;
}
コード例 #5
0
ファイル: noteindexer.cpp プロジェクト: BigOz/Nixnote2
// Index any PDFs that are attached.  Basically it turns the PDF into text and adds it the same
// way as a note's body
void NoteIndexer::indexPdf(qint32 reslid) {

    NSqlQuery sql(global.db);
    if (reslid <= 0)
        return;

    QString file = global.fileManager.getDbaDirPath() + QString::number(reslid) +".pdf";

    QString text = "";
    Poppler::Document *doc = Poppler::Document::load(file);
    if (doc == NULL || doc->isEncrypted() || doc->isLocked())
        return;

    for (int i=0; i<doc->numPages(); i++) {
        QRectF rect;
        text = text + doc->page(i)->text(rect) + QString(" ");
    }

    // Add the new content.  it is basically a text version of the note with a weight of 100.
    sql.prepare("Insert into SearchIndex (lid, weight, source, content) values (:lid, :weight, :source, :content)");
    sql.bindValue(":lid", reslid);
    sql.bindValue(":weight", 100);
    sql.bindValue(":source", "recognition");
    sql.bindValue(":content", text);
    sql.exec();
}
コード例 #6
0
ファイル: indexrunner.cpp プロジェクト: turbochad/Nixnote2
// Index any PDFs that are attached.  Basically it turns the PDF into text and adds it the same
// way as a note's body
void IndexRunner::indexPdf(qint32 lid, Resource &r) {
    if (!keepRunning || pauseIndexing) {
        indexTimer->start();
        return;
    }
    ResourceTable rtable(&db->conn);
    qint32 reslid = rtable.getLid(r.guid);
    if (lid <= 0) {
        indexTimer->start();
        return;
    }
    QString file = global.fileManager.getDbaDirPath() + QString::number(reslid) +".pdf";

    QString text = "";
    Poppler::Document *doc = Poppler::Document::load(file);
    if (doc == NULL) {
        indexTimer->start();
        return;
    }
    for (int i=0; keepRunning && !pauseIndexing && i<doc->numPages(); i++) {
        QRectF rect;
        text = text + doc->page(i)->text(rect) + QString(" ");
    }
    IndexRecord *rec = new IndexRecord();
    rec->content = text;
    rec->source = "recognition";
    rec->weight = 100;
    rec->lid = lid;
    if (indexHash->contains(lid)) {
        delete indexHash->value(lid);
        indexHash->remove(lid);
    }
    indexHash->insert(lid, rec);
}
コード例 #7
0
ファイル: tocman.cpp プロジェクト: cbiffle/runcible
void TocManager::refresh() {
  Poppler::Document *doc = Poppler::Document::load(_path);

  if (doc) {
    QList<Choice> choices;
    QUrl docUrl("file:" + _path);
    QDomDocument *toc = doc->toc();
    if (toc) {
      QDomNode child = toc->documentElement();
      copyToc(docUrl, doc, child, choices, 0);
      /*
      while (!child.isNull()) {
        if (child.isElement()) {
          QDomElement el = child.toElement();
          QString destName = el.attribute("DestinationName", "");
          Poppler::LinkDestination *dest = doc->linkDestination(destName);
          QUrl url("file:" + _path + "#page:" + QString::number(dest->pageNumber()));
          choices << Choice(el.nodeName(), url.toString());
          delete dest;
        }
        child = child.nextSibling();
      }
      */
      delete toc;
    } else {
      qDebug() << "NO TOC";
    }

    emit contentsChanged(choices);
  }

  delete doc;
}
コード例 #8
0
ファイル: WINPrint.cpp プロジェクト: xywei/texmacs
WINPrint::~WINPrint() {
  if (!doit) return;
  Poppler::Document* document = Poppler::Document::load(file);
  if (document) {
    document->setRenderHint(Poppler::Document::Antialiasing);
    document->setRenderHint(Poppler::Document::TextAntialiasing);

    int nbpages=document->numPages(), nextpage=nbpages-1;
    QPainter Paint;
    if(Paint.begin(Prt)) {
      QImage image;
      QRect rect (0, 0,
                  Prt->paperRect (QPrinter::DevicePixel).width(),
                  Prt->paperRect(QPrinter::DevicePixel).height());
      double rres= Prt->resolution();
      Paint.setRenderHint (QPainter::Antialiasing);
      for (int pg=0;pg < nbpages;pg++) {
        Poppler::Page* pdfPage = document->page (pg);  
        if (pdfPage) {
          image= pdfPage->renderToImage (rres, rres);
          delete pdfPage;
        }
        if (!image.isNull()) {
          Paint.drawImage (rect, image);
          if (pg != nextpage) Prt->newPage();
        }
        else convert_error << "Fail to create image at "
                           << rres << " dpi resolution\n";
      }
      Paint.end();
    }
    delete (document);
  }
}
コード例 #9
0
ファイル: check_links.cpp プロジェクト: BlueBrain/Poppler
void TestLinks::checkDests_xr01()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/xr01.pdf");
    QVERIFY( doc );

    Poppler::Page *page = doc->page(0);
    QVERIFY( page );

    QList< Poppler::Link* > links = page->links();
    QCOMPARE( links.count(), 2 );

    {
    QCOMPARE( links.at(0)->linkType(), Poppler::Link::Goto );
    Poppler::LinkGoto *link = static_cast< Poppler::LinkGoto * >( links.at(0) );
    const Poppler::LinkDestination dest = link->destination();
    QVERIFY( !isDestinationValid_pageNumber( &dest, doc ) );
    QVERIFY( isDestinationValid_name( &dest ) );
    QCOMPARE( dest.destinationName(), QString::fromLatin1("section.1") );
    }

    {
    QCOMPARE( links.at(1)->linkType(), Poppler::Link::Goto );
    Poppler::LinkGoto *link = static_cast< Poppler::LinkGoto * >( links.at(1) );
    const Poppler::LinkDestination dest = link->destination();
    QVERIFY( !isDestinationValid_pageNumber( &dest, doc ) );
    QVERIFY( isDestinationValid_name( &dest ) );
    QCOMPARE( dest.destinationName(), QString::fromLatin1("section.2") );
    }

    delete doc;
}
コード例 #10
0
void NCSAFindBar::performSearch()
{
  
  if(wordSpottingUtil == NULL)
  {
    this->preprocessDocument();
  }
     
     QPixmap search_input(display->size());
     display->render(&search_input);     
     
     searchResult = wordSpottingUtil->search(search_input, 10);
     
     
     QString filepath =  getFilePath();
     Poppler::Document *pdf = Poppler::Document::load(filepath);  
     
     ////////displaying results
     resultComboBox->clear();
     for(int i = 0; i < searchResult.size(); i++)
     {
       NCSAWordInfo* wordInfo = searchResult[i];
       QImage returnedPage = pdf->page(wordInfo->pagenum)->renderToImage(150,150); //TODO: get rid of having to read the file again
       //QImage returnedPage = *(wordInfo->page);
       const QImage word = returnedPage.copy(wordInfo->box->x, wordInfo->box->y, wordInfo->box->w, wordInfo->box->h);

       resultComboBox->addItem(QPixmap::fromImage(word), "", -1);
       returnedPage.height();
       returnedPage.width();

     }
     QSize size(100,30);
     resultComboBox->setIconSize(size);
     
}
コード例 #11
0
ファイル: mainwindow.cpp プロジェクト: ogh/pdffoldersearch
//TODO think about storing the documents instead of the filenames in a list
//Would avoid creation of the documents for each search but probably take up more memory
bool MainWindow::searchPDFPostResults(const QFileInfo &fi, QString searchString)
{
    bool nHitsExceeded = false;
    Poppler::Document *document = Poppler::Document::load(fi.absoluteFilePath());
    if (!document || document->isLocked()) {
      //Oops, document empty => error message
      QMessageBox mbox;
      mbox.setText(tr("Could not read the file \n'") + fi.fileName() +
                   tr("\ntherefore, possible matches might be missing"));
      mbox.exec();
      delete document;
      return false;
    }
    //Get document title
    QString title = document->info("Title");
    //If no title specified => use filename instead
    if(title == "")
        title = fi.fileName();
    QString shortTitle = QString(title);
    if (shortTitle.length() > 16)
    {
        shortTitle = "..." + shortTitle.right(16);
    }
    ui->statusBar->showMessage("Durchsuche PDF: " + shortTitle);
    qDebug() << "Searching pdf: " << title;
    //Search the document for the searchString
    int hitCounter = 0;
    for (int page = 0; page < document->numPages(); page++) {
        //Parameters 1,2,3,4 of the search function
        //will contain the rectangle coordinates of where the text was found.
        //Since we are not interested in these coordinates, we just pass a single variable
        double coordinate = 0.0;
        if (document->page(page)->search(searchString, coordinate,coordinate,coordinate,coordinate,
            Poppler::Page::NextResult,
            Poppler::Page::CaseInsensitive)) {
            hitCounter++;
            ui->statusBar->showMessage(tr("Searching in ") + shortTitle +
                                       " - hit on page: " + QString::number(page));
            //Yay, we found the search String on this page
            //=> Add this page to the result list
            addDocNPageToResultList(title, fi, page);
            // TODO make this limit a variable
            if(hitCounter >= maxHits)
            {
                QMessageBox mbox;
                mbox.setText(tr("Search has already reached the maximum of ") + QString::number(maxHits)
                             + tr(" hits please choose a more specific criterion"));
                mbox.exec();
                nHitsExceeded = true;
                break;
            }
        }
    }

    //Don't forget to delete the document
    delete document;
    //Return whether the max number of hits was reached
    return nHitsExceeded;
}
コード例 #12
0
void guFolderInspector::extractIsbnsFromPdf(QString fileName, QList<QString> &ISBNList)
{
    //PDFDoc *doc;
    //doc = new PDFDoc()
    //qDebug() << "file:" << fileName;
    Poppler::Document* document;
    document = Poppler::Document::load(fileName,0,0);


    //Poppler::Document::
    if (!document || document->isLocked()) {

        // ... error message ....
        delete document;
        return;
    }
    // Paranoid safety check
    if (!document) {
        // ... error message ...
        return;
    }

    Poppler::Page* pdfPage;
    isbnMethods find;

    // Access page of the PDF file
    int numOfPages = document->numPages(); //количество страниц
    int numOfSearchPages = 15;
    //qDebug() << "num of pages " << numOfPages;
    if(numOfPages < numOfSearchPages)
    {
        numOfSearchPages = numOfPages;
    }
    for ( int pageNumber = 0 ; pageNumber < numOfSearchPages ; pageNumber++)
    {
        pdfPage = document->page(pageNumber);  // Document starts at page 0
        if (!pdfPage) {
            // ... error message ...
            continue;
        }

        //QtMsgHandler qInstallMsgHandler ( QtMsgHandler handler )
        QString pageContent;
        pageContent = pdfPage->text(QRectF(QPointF(0,0),pdfPage->pageSizeF()));

        find.findIsbns(pageContent, ISBNList);

        // ... use image ...
        //qDebug() << pageContent;
    }

    // after the usage, the page must be deleted
    delete pdfPage;

    //Finally, don't forget to destroy the document:

    delete document;
}
コード例 #13
0
ファイル: check_password.cpp プロジェクト: BlueBrain/Poppler
void TestPassword::password2a()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load(QString::fromUtf8(TESTDATADIR "/unittestcases/Gday garçon - owner.pdf"), QString::fromUtf8("garçon").toLatin1() );
    QVERIFY( doc );
    QVERIFY( !doc->isLocked() );

    delete doc;
}
コード例 #14
0
void TestMetaData::checkVersion()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load("../../../test/unittestcases/doublepage.pdf");
    QVERIFY( doc );

    QCOMPARE( doc->pdfVersion(), 1.6 );

    delete doc;
}
コード例 #15
0
void TestOptionalContent::checkNoOptionalContent()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/orientation.pdf");
    QVERIFY( doc );

    QCOMPARE( doc->hasOptionalContent(), false );

    delete doc;
}
コード例 #16
0
ファイル: check_pagemode.cpp プロジェクト: 4ian/emscripten
void TestPageMode::checkFullScreen()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load("../../../test/unittestcases/FullScreen.pdf");
    QVERIFY( doc );

    QCOMPARE( doc->pageMode(), Poppler::Document::FullScreen );

    delete doc;
}
コード例 #17
0
ファイル: check_pagemode.cpp プロジェクト: 4ian/emscripten
void TestPageMode::checkOC()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load("../../../test/unittestcases/UseOC.pdf");
    QVERIFY( doc );

    QCOMPARE( doc->pageMode(), Poppler::Document::UseOC );

    delete doc;
}
コード例 #18
0
void TestPageMode::checkThumbs()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/UseThumbs.pdf");
    QVERIFY( doc );

    QCOMPARE( doc->pageMode(), Poppler::Document::UseThumbs );

    delete doc;
}
コード例 #19
0
void TestAttachments::checkNoAttachments()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
    QVERIFY( doc );

    QCOMPARE( doc->hasEmbeddedFiles(), false );

    delete doc;
}
コード例 #20
0
ファイル: check_fonts.cpp プロジェクト: 13609594236/CrossApp
void TestFontsData::checkNoFonts()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load("../../../test/tests/image.pdf");
    QVERIFY( doc );

    QList<Poppler::FontInfo> listOfFonts = doc->fonts();
    QCOMPARE( listOfFonts.size(), 0 );

    delete doc;
}
コード例 #21
0
ファイル: check_fonts.cpp プロジェクト: 13609594236/CrossApp
void TestFontsData::checkFontIterator()
{
    // loading a 1-page document
    Poppler::Document *doc;
    doc = Poppler::Document::load("../../../test/tests/type3.pdf");
    QVERIFY( doc );
    // loading a 6-pages document
    Poppler::Document *doc6 = Poppler::Document::load("../../../test/tests/cropbox.pdf");
    QVERIFY( doc6 );

    std::auto_ptr< Poppler::FontIterator > it;

    // some tests with the 1-page document:
    // - check a default iterator
    it.reset( doc->newFontIterator() );
    QVERIFY( it->hasNext() );
    // - check an iterator for negative pages to behave as 0
    it.reset( doc->newFontIterator( -1 ) );
    QVERIFY( it->hasNext() );
    // - check an iterator for pages out of the page limit
    it.reset( doc->newFontIterator( 1 ) );
    QVERIFY( !it->hasNext() );
    // - check that it reaches the end after 1 iteration
    it.reset( doc->newFontIterator() );
    QVERIFY( it->hasNext() );
    it->next();
    QVERIFY( !it->hasNext() );

    // some tests with the 6-page document:
    // - check a default iterator
    it.reset( doc6->newFontIterator() );
    QVERIFY( it->hasNext() );
    // - check an iterator for pages out of the page limit
    it.reset( doc6->newFontIterator( 6 ) );
    QVERIFY( !it->hasNext() );
    // - check that it reaches the end after 6 iterations
    it.reset( doc6->newFontIterator() );
    QVERIFY( it->hasNext() );
    it->next();
    QVERIFY( it->hasNext() );
    it->next();
    QVERIFY( it->hasNext() );
    it->next();
    QVERIFY( it->hasNext() );
    it->next();
    QVERIFY( it->hasNext() );
    it->next();
    QVERIFY( it->hasNext() );
    it->next();
    QVERIFY( !it->hasNext() );

    delete doc;
    delete doc6;
}
コード例 #22
0
void TestMetaData::checkDate()
{
    Poppler::Document *doc;

    doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
    QVERIFY( doc );
    QCOMPARE( doc->date("ModDate"), QDateTime(QDate(2005, 12, 5), QTime(9,44,46), Qt::UTC ) );
    QCOMPARE( doc->date("CreationDate"), QDateTime(QDate(2005, 8, 13), QTime(1,12,11), Qt::UTC ) );

    delete doc;
}
コード例 #23
0
ファイル: check_password.cpp プロジェクト: BlueBrain/Poppler
void TestPassword::password3()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load( QString::fromUtf8(TESTDATADIR "/unittestcases/PasswordEncrypted.pdf") );
    QVERIFY( doc );
    QVERIFY( doc->isLocked() );
    QVERIFY( !doc->unlock( "", "password" ) );
    QVERIFY( !doc->isLocked() );

    delete doc;
}
コード例 #24
0
void TestMetaData::checkSeascapeOrientation()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load("../../../test/unittestcases/orientation.pdf");
    QVERIFY( doc );

    Poppler::Page *page = doc->page(3);
    QCOMPARE( page->orientation(), Poppler::Page::Seascape );

    delete page;
    delete doc;
}
コード例 #25
0
void TestMetaData::checkStrings2()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
    QVERIFY( doc );

    QFETCH( QString, key );
    QFETCH( QString, value );
    QCOMPARE( doc->info(key), value );

    delete doc;
}
コード例 #26
0
void TestMetaData::checkPageSize()
{
    Poppler::Document *doc;

    doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
    QVERIFY( doc );
    Poppler::Page *page = doc->page(0);
    QCOMPARE( page->pageSize(), QSize(595, 842) );
    QCOMPARE( page->pageSizeF(), QSizeF(595.22, 842) );

    delete page;
    delete doc;
}
コード例 #27
0
ファイル: check_links.cpp プロジェクト: BlueBrain/Poppler
void TestLinks::checkDocumentWithNoDests()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load(TESTDATADIR "/unittestcases/WithAttachments.pdf");
    QVERIFY( doc );

    std::auto_ptr< Poppler::LinkDestination > dest;
    dest.reset( doc->linkDestination("no.dests.in.this.document") );
    QVERIFY( !isDestinationValid_pageNumber( dest.get(), doc ) );
    QVERIFY( isDestinationValid_name( dest.get() ) );

    delete doc;
}
コード例 #28
0
ファイル: check_fonts.cpp プロジェクト: 13609594236/CrossApp
void TestFontsData::checkSecondDocumentQuery()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load("../../../test/tests/type3.pdf");
    QVERIFY( doc );

    QList<Poppler::FontInfo> listOfFonts = doc->fonts();
    QCOMPARE( listOfFonts.size(), 2 );
    // check we get the very same result when calling fonts() again (#19405)
    QList<Poppler::FontInfo> listOfFonts2 = doc->fonts();
    QCOMPARE( listOfFonts, listOfFonts2 );

    delete doc;
}
コード例 #29
0
void TestMetaData::checkNumPages()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load("../../../test/unittestcases/doublepage.pdf");
    QVERIFY( doc );
    QCOMPARE( doc->numPages(), 2 );

    delete doc;

    doc = Poppler::Document::load("../../../test/unittestcases/truetype.pdf");
    QVERIFY( doc );
    QCOMPARE( doc->numPages(), 1 );

    delete doc;
}
コード例 #30
0
void TestActualText::checkActualText1()
{
    Poppler::Document *doc;
    doc = Poppler::Document::load("../../../test/unittestcases/WithActualText.pdf");
    QVERIFY( doc );

    Poppler::Page *page = doc->page(0);
    QVERIFY( page );

    QCOMPARE( page->text(QRectF()), QString("The slow brown fox jumps over the black dog.") );

    delete page;

    delete doc;
}