1

Xilinx Zynq SoC 上で Linux/Qt5 を実行する現在取り組んでいる組み込みデバイスに PDF ビューアを追加したいと考えています。通常、デバイスは非常に高速で、QCustomPlot を使用して 100 ミリ秒ごとに 8192 ポイントのプロットをプロットするなど、ある程度の作業負荷に対処できます。

私は Poppler/libpoppler に出くわし、目の前のタスクを実行する、つまり PDF を表示するのに最適だと思いました。いくつかのデモ コードを作成しました。このコードから poppler の renderToImage() メソッドを呼び出すのに約 1 分かかり、PDF を画像に変換して UI に表示できます。

Poppler-Qt5 を使用して、同様の結果や高速化の方法を見つけた人はいますか? そうでない場合、Qt とうまく統合されている他のライブラリを検討する必要がありますか?

これが私のデモコードのスニペットです:

// Load pdf
Poppler::Document* document = Poppler::Document::load("/tmp/test.pdf");
document->setRenderHint(Poppler::Document::Antialiasing);
document->setRenderHint(Poppler::Document::TextAntialiasing);

if (!document || document->isLocked() || document == 0 )
{
    cout << "ERROR" << endl;
}

Poppler::Page* pdfPage = document->page(0);
if (pdfPage == 0)
{
    cout << "ERROR" << endl;
}

// Generate a QImage of the rendered page
QImage image = pdfPage->renderToImage(72.0,72.0,0,0,pdfPage->pageSize().width(),pdfPage->pageSize().height());
if (image.isNull())
{
    cout << "ERROR" << endl;
}

ui->label->setPixmap(QPixmap::fromImage(image));
ui->label->show();

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

0 に答える 0