I realize that Podofo does not implement all Predictors. I just wanted to make double sure that this is the case with regards to the attached. PDF. I would like to explore the use of predictors further (I know it's probably quiet advanced) as I will run into this problem again. I am trying to decompress a single Xref Stream in the attached PDF document. The code I have provided below can decode any chosen FlateDecode stream but when I include DecodeParms for a stream encoded using DecodeParms such as the Xref stream in Object 15 0 obj I just get jumbled output. I know I've been through this but I'm hoping someone can take a look at this. The Decode method is on line 60.The Object to select is on line 16.// you can change this and set the PdfDictionary variable dict on line 60 to NULL to see that this will decode other streams. I just can't get Xref Stream in 15 0 obj to decompress when I include DecodeParms. My code is pretty average but would someone mind taking a look. This is driving me mad.All I want to do is decompress the Xref Stream. Thanks
https://lists.sourceforge.net/lists/listinfo/podofo-users
#include <iostream> #include <string> #include <cstdlib> #include <podofo/podofo.h> using namespace PoDoFo; using namespace std; int main(int argc, char **argv) { PdfMemDocument doc; doc.Load("test.pdf"); PdfReference *refs = new PdfReference(15,0); PdfVecObjects ob = doc.GetObjects(); PdfObject *obj = ob.GetObject(*refs); PdfStream *strm = obj->GetStream(); char* mms = new char; pdf_long *ln = new pdf_long; *ln = strm->GetLength(); strm->GetCopy(&mms,ln); cout << "length: " << *ln << endl; cout << endl << endl; //PARMS PdfDictionary &mydict = obj->GetDictionary(); //display dictionary string mm; obj->ToString(mm,ePdfWriteMode_Clean); cout << endl << "THE DICTIONARY EXTRACTED: " << endl << endl << mm << endl << endl; //declare variables for Filter->Decode method. PdfDictionary *dict = &mydict; pdf_long inputsize = *ln; pdf_long *outputsize = new pdf_long; char* inputbuffer = mms; char* outputbuffer = new char; // FILTERS PdfFilterFactory Factory; static std::auto_ptr<PdfFilter> myfilter; myfilter = Factory.Create(ePdfFilter_FlateDecode); myfilter->Decode(mms,inputsize,&outputbuffer,outputsize,dict); cout << "Filtering Complete" << endl << endl; cout << "output size: " << *outputsize << endl << endl; cout << "THE OUTPUT IS BELOW: " << endl << endl; for (int x = 0; x < *outputsize; x++) { cout << outputbuffer[x]; } cout << endl << endl; system("pause>null"); }
test.pdf
Description: Adobe PDF document
------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/
_______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users