[poppler] Poppler::renderToImage() error

Albert Astals Cid aacid at kde.org
Thu May 26 10:46:03 PDT 2011


A Thursday, May 26, 2011, alessandro mason va escriure:
> Hi,
> I made a patch for PureData tha includes this code:
> 
> poppler::poppler()
> {
>     //ctor
> }
> poppler::poppler(const char* file)
> {//ctor
>     loaded=loadedpage=save=true;
>     document= Poppler::Document::load(file);//open the document file
>     if (!document || document->isLocked()) {
>             loaded=false;
>                 delete document;
>                 }
> 
> }//end cosntructor
> 
>   void poppler::selPage(int page){
>         poppler::pdfPage=document->page(1);  // Document starts at page 0
>             if (pdfPage == 0) {
>                 loadedpage=false;
>                 }
>             // Generate a QImage of the rendered page
>     loaded=true;
>    tmp = poppler::pdfPage->renderToImage(72,72,-1,-1,-1,-1);//
>     if (tmp.isNull()) {
>       loaded=false;
>     }
> 
>     filename=QString("page.bmp");
>     save=tmp.save(filename,"BMP",50);//savepage
> 
> }
> 
> poppler::~poppler()
> {
>     //dtor
>     delete poppler::pdfPage;
>     delete poppler::document;
> }
> 
> With Debian this code works, but now with Ubuntu 11.4 doesn't work because
> it doesn't save the image.
> Can anyone help me?

Can you give more data? You have some variables there to check for errors, is 
any of them failing?

Albert

> Sorry for my english
> 
> Mason Alessandro


More information about the poppler mailing list