docexample_getthumbnail.cpp

00001 #include "NOPackage.h"
00002 #include "NOThumbnail.h"
00003 
00004 using namespace NiXPSObjects;
00005 
00006 void getThumbnail(const UTF8Char *pXPSIn, const UTF8Char *pImageOut)
00007 {
00008         NOPackage *lPackageSource=NOPackage::readPackageFromFile(pXPSIn);       
00009         
00010         if (lPackageSource->hasThumbnail())
00011         {
00012                 NOThumbnail lThumb = lPackageSource->getThumbnail();    
00013                 const UInt32 lSize = lThumb.getImageSize();
00014                 UInt8 *lBuffer = new UInt8[lSize];
00015                 lThumb.getImageData(lBuffer,lSize);
00016 
00017                 // write the buffer to file
00018                 FILE *lOut=fopen(pImageOut,"wb");
00019                 fwrite(lBuffer,1,lSize,lOut);
00020                 fclose(lOut);
00021 
00022                 delete [] lBuffer;
00023         }
00024 
00025         NOPackage::destroyPackage(lPackageSource);
00026 }

Generated on Thu Jul 3 15:30:32 2008 for NiXPS Library SDK by  doxygen 1.5.3