本文整理汇总了C++中poppler::Document::setRenderHint方法的典型用法代码示例。如果您正苦于以下问题:C++ Document::setRenderHint方法的具体用法?C++ Document::setRenderHint怎么用?C++ Document::setRenderHint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poppler::Document
的用法示例。
在下文中一共展示了Document::setRenderHint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rect
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);
}
}
示例2: run
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;
}
示例3: main
int main(int argc, char **argv)
{
if (argc != 2) {
std::cout << "Usage: " << argv[0] << " PDF" << std::endl;
return 1;
}
QString filename(argv[1]);
Poppler::Document* document = Poppler::Document::load(filename);
document->setRenderHint(Poppler::Document::TextHinting, true);
document->setRenderHint(Poppler::Document::TextSlightHinting, true);
Poppler::Page* pdfPage = document->page(0);
// dpi must be high enough
QImage image = pdfPage->renderToImage(200, 200);
return 0;
}
示例4: getNewThumbPopplerPage
Poppler::Page* PDFPageWidget::getNewThumbPopplerPage(){
Poppler::Document *thumbDoc = Poppler::Document::load(oriFilePath);
thumbDoc->setRenderHint(Poppler::Document::TextAntialiasing);
return thumbDoc->page(pageNo);
}
示例5: 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;
}