Пример #1
0
bool FaxGenerator::loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector )
{
    FaxDocument::DocumentType type;
    if ( fileName.toLower().endsWith( ".g3" ) )
        type = FaxDocument::G3;
    else
        type = FaxDocument::G4;

    FaxDocument faxDocument( fileName, type );

    if ( !faxDocument.load() )
    {
        emit error( i18n( "Unable to load document" ), -1 );
        return false;
    }

    m_img = faxDocument.image();

    pagesVector.resize( 1 );

    Okular::Page * page = new Okular::Page( 0, m_img.width(), m_img.height(), Okular::Rotation0 );
    pagesVector[0] = page;

    m_docInfo = new Okular::DocumentInfo();
    if ( type == FaxDocument::G3 )
        m_docInfo->set( Okular::DocumentInfo::MimeType, "image/fax-g3" );
    else
        m_docInfo->set( Okular::DocumentInfo::MimeType, "image/fax-g4" );

    return true;
}
Пример #2
0
bool FaxGenerator::loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector )
{
    if ( fileName.toLower().endsWith( ".g3" ) )
        m_type = FaxDocument::G3;
    else
        m_type = FaxDocument::G4;

    FaxDocument faxDocument( fileName, m_type );

    if ( !faxDocument.load() )
    {
        emit error( i18n( "Unable to load document" ), -1 );
        return false;
    }

    m_img = faxDocument.image();

    pagesVector.resize( 1 );

    Okular::Page * page = new Okular::Page( 0, m_img.width(), m_img.height(), Okular::Rotation0 );
    pagesVector[0] = page;

    return true;
}