Hi all,
I managed to embed a file (or file content/string) into a PdfMemDocument. Now I want to extract it again and don´t find a way...
----- Embed file -------
PdfMemDocument document;
PdfMemDocument document;
...
document.AttachFile( PdfFileSpec(TEMP_FILENAME,
(const unsigned char*)(fileData.toStdString().c_str()),
fileData.size(), &document) );
document.Write(pdfFilename);
------------
(const unsigned char*)(fileData.toStdString().c_str()),
fileData.size(), &document) );
document.Write(pdfFilename);
------------
------ Extract file ------
PdfMemDocument* pdfDoc = new PdfMemDocument(pdfFilename);
PdfMemDocument* pdfDoc = new PdfMemDocument(pdfFilename);
PdfNamesTree* namesObj = pdfDoc->GetNamesTree( PoDoFo::ePdfDontCreateObject );
if( namesObj )
{
PdfDictionary dict;
namesObj->ToDictionary( PdfName("EmbeddedFiles"), dict );
if( namesObj )
{
PdfDictionary dict;
namesObj->ToDictionary( PdfName("EmbeddedFiles"), dict );
const TKeyMap& keys = dict.GetKeys();
TCIKeyMap it = keys.begin();
TCIKeyMap it = keys.begin();
while( it != keys.end() )
{
qDebug() << (*it).first.GetName().c_str();
{
qDebug() << (*it).first.GetName().c_str();
// How to get the file content from filename?
}
}
------------
}
}
------------
I tried using a PdfMemStream but I didn´t get it to work. Any suggestions on how to get the embedded file back from the pdf?
Sebastian
------------------------------------------------------------------------------ LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users