During the extraction of images from a PDF file I have a problem extracting
FlateDecoded images. The following piece of code fails on the GetFilteredCopy
method.
PdfObject * imagePtr = m_pdfPagePtr->GetFromResources( PdfName(
"XObject" ), imageRef.GetName() );
PdfObject * imageFilterPtr = imagePtr->GetDictionary().GetKey(
PdfName::KeyFilter );
if ( imageFilterPtr && imageFilterPtr->IsName() &&
imageFilterPtr->GetName().GetName() == "FlateDecode" )
{
PdfMemStream *streamPtr = dynamic_cast<PdfMemStream *>(
(*imagePtr).GetStream() );
char fileName[ 30];
char filePath[256];
snprintf( fileName, 30, "image%04i_%04i",
m_pdfPagePtr->GetPageNumber(), ++m_imageCount );
snprintf( filePath, 256, "%s%s", outputDir.c_str(), fileName );
FILE * fileHandle = fopen( filePath, "wb" );
char * filePtr;
pdf_long bufferSize;
streamPtr->GetFilteredCopy( &filePtr, &bufferSize );
fwrite( filePtr, bufferSize, sizeof(char), fileHandle );
fclose( fileHandle );
}
The actual error is:
PoDoFo encounter an error. Error: 22 ePdfError_InvalidPredictor
Callstack:
#0 Error Source:
/home/jo/dvlp/dev/podofo-trunc/podofo/src/PdfFiltersPrivate.cpp:538
#1 Error Source:
/home/jo/dvlp/dev/podofo-trunc/podofo/src/PdfFiltersPrivate.cpp:145
The image is correctly displaying in a PDF reader.
Any idea what might be the cause?
- Jo
This e-mail and any attachments thereto may contain information which is
confidential
and/or protected by intellectual property rights and are intended for the sole
use of the
recipient(s) named above. Any use of the information contained herein
(including, but
not limited to, total or partial reproduction, communication or distribution in
any form)
by persons other then the designated recipient(s) is prohibited. If you have
received this
e-mail in error, please notify the sender either by telephone or by e-mail and
delete the
material from any computer. Thank you for your cooperation.
Dilys bvba
Nieuwe Stationsstraat 23
9160 Lokeren
tel +32 9 356 97 13
fax +32 9 353 90 11
mailto:[email protected]
http://www.dilys.be
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users