Logo Search packages:      
Sourcecode: libpodofo version File versions  Download package

void PoDoFo::PdfStream::GetFilteredCopy ( char **  pBuffer,
pdf_long *  lLen 
) const

Get a malloced buffer of the current stream which has been filtered by all filters as specified in the dictionary's /Filter key. For example, if the stream is Flate compressed, the buffer returned from this method will have been decompressed.

The caller has to free() the buffer.

Parameters:
pBufferpointer to the buffer
lLenpointer to the buffer length

Definition at line 73 of file PdfStream.cpp.

References PoDoFo::PdfMemoryOutputStream::Close(), PoDoFo::PdfFilterFactory::CreateDecodeStream(), PoDoFo::PdfFilterFactory::CreateFilterList(), PoDoFo::PdfVariant::GetDictionary(), GetInternalBuffer(), GetInternalBufferSize(), PoDoFo::PdfMemoryOutputStream::GetLength(), PoDoFo::PdfMemoryOutputStream::TakeBuffer(), and PoDoFo::PdfMemoryOutputStream::Write().

Referenced by BeginAppend(), ImageExtractor::ExtractImage(), PoDoFo::PdfDocument::FillXObjectFromDocumentPage(), PoDoFo::PdfXRefStreamParserObject::ParseStream(), PoDoFo::PdfContentsTokenizer::SetCurrentContentsStream(), PoDoFo::Impose::PdfTranslator::setTarget(), and PoDoFo::PdfMemStream::Uncompress().

{
    TVecFilters            vecFilters    = PdfFilterFactory::CreateFilterList( m_pParent );
    PdfMemoryOutputStream  stream;
    if( vecFilters.size() )
    {
        // Use std::auto_ptr so that pDecodeStream is deleted 
        // even in the case of an exception 
        std::auto_ptr<PdfOutputStream> pDecodeStream( PdfFilterFactory::CreateDecodeStream( vecFilters, &stream, 
                                                                                            m_pParent ? 
                                                                                            &(m_pParent->GetDictionary()) : NULL  ) );

        pDecodeStream->Write( this->GetInternalBuffer(), this->GetInternalBufferSize() );
        pDecodeStream->Close();
    }
    else
    {
        // Also work on unencoded streams
        stream.Write( const_cast<char*>(this->GetInternalBuffer()), this->GetInternalBufferSize() );
        stream.Close();
    }

    *lLen     = stream.GetLength();
    *ppBuffer = stream.TakeBuffer();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index