本文整理汇总了C++中poppler::Document::setRenderBackend方法的典型用法代码示例。如果您正苦于以下问题:C++ Document::setRenderBackend方法的具体用法?C++ Document::setRenderBackend怎么用?C++ Document::setRenderBackend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poppler::Document
的用法示例。
在下文中一共展示了Document::setRenderBackend方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char **argv )
{
QApplication a( argc, argv ); // QApplication required!
if ( argc < 2 ||
(argc == 3 && strcmp(argv[2], "-arthur") != 0) ||
argc > 3)
{
// use argument as file name
qWarning() << "usage: test-poppler-qt4 filename [-arthur]";
exit(1);
}
Poppler::Document *doc = Poppler::Document::load(QFile::decodeName(argv[1]));
if (!doc)
{
qWarning() << "doc not loaded";
exit(1);
}
if (doc->isLocked())
{
qWarning() << "document locked (needs password)";
exit(0);
}
if (doc->numPages() <= 0)
{
delete doc;
qDebug() << "Doc has no pages";
return 0;
}
QString backendString;
if (argc == 3 && strcmp(argv[2], "-arthur") == 0)
{
backendString = "Arthur";
doc->setRenderBackend(Poppler::Document::ArthurBackend);
}
else
{
backendString = "Splash";
doc->setRenderBackend(Poppler::Document::SplashBackend);
}
doc->setRenderHint(Poppler::Document::Antialiasing, true);
doc->setRenderHint(Poppler::Document::TextAntialiasing, true);
for (int i = 0; i < doc->numPages(); ++i)
{
Poppler::Page *page = doc->page(i);
if (page) {
qDebug() << "Rendering page using" << backendString << "backend: " << i;
QTime t = QTime::currentTime();
QImage image = page->renderToImage();
qDebug() << "Rendering took" << t.msecsTo(QTime::currentTime()) << "msecs";
image.save(QString("test-rennder-to-file%1.ppm").arg(i));
delete page;
}
}
return 0;
}