Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Fri, 6 Jun 2008 13:24:03 -0700,    group: microsoft.public.platformsdk.shell        back       


Generating thumbnail of PDF documents using Shell?   
Is it possible to generate the thumbnails of PDF documents using shell 
programming interfaces? For example using IExtractImage? Or do I need to 
install some software in addition to platform SDK to perform that?

Thanks for any suggestions!
date: Fri, 6 Jun 2008 13:24:03 -0700   author:   Diffident

Re: Generating thumbnail of PDF documents using Shell?   
On 6 Jun, 21:24, Diffident 
wrote:
> Is it possible to generate the thumbnails of PDF documents using shell
> programming interfaces? For example using IExtractImage? Or do I need to
> install some software in addition to platform SDK to perform that?
>
> Thanks for any suggestions!

thumbnail generation is not the job of shell but of the document
provider. If you install any latest version of adobe reader you'll get
automatic PDF thumbnails in explorer and shell in general
date: Mon, 16 Jun 2008 02:03:00 -0700 (PDT)   author:   nikos

Re: Generating thumbnail of PDF documents using Shell?   
Hi Nikos,

I do have the latest Adobe reader installed and I am able to view the 
thumbnails for PDF documents in windows explorer but I am not able to get the 
GetUIObjectOf interface for these documents. I am able to get this interface 
for Office documents.

Any ideas/suggestions?

"nikos" wrote:

> On 6 Jun, 21:24, Diffident 
> wrote:
> > Is it possible to generate the thumbnails of PDF documents using shell
> > programming interfaces? For example using IExtractImage? Or do I need to
> > install some software in addition to platform SDK to perform that?
> >
> > Thanks for any suggestions!
> 
> thumbnail generation is not the job of shell but of the document
> provider. If you install any latest version of adobe reader you'll get
> automatic PDF thumbnails in explorer and shell in general
>
date: Mon, 16 Jun 2008 07:07:01 -0700   author:   Diffident

Re: Generating thumbnail of PDF documents using Shell?   
IExtractImage should work then. I have seen that some PDFs don't
extract thumbnails properly, but some others do. Play a bit with the
flags passed to GetLocation() and see if it helps at all
date: Mon, 16 Jun 2008 08:05:48 -0700 (PDT)   author:   nikos

Re: Generating thumbnail of PDF documents using Shell?   
Thanks for the suggestions, Nikos. I will try them out.....

"nikos" wrote:

> IExtractImage should work then. I have seen that some PDFs don't
> extract thumbnails properly, but some others do. Play a bit with the
> flags passed to GetLocation() and see if it helps at all
>
date: Mon, 16 Jun 2008 08:20:00 -0700   author:   Diffident

Re: Generating thumbnail of PDF documents using Shell?   
function GetFileImage(const Filename: WideString; PreviewSize: Integer): 
HBITMAP;

 const
  IEI_PRIORITY_MAX     = $0002;
  IEI_PRIORITY_MIN     = $0001;
  IEI_PRIORITY_NORMAL  = $0000;
  IEIFLAG_ASYNC    = $0001;     // ask the extractor if it supports ASYNC 
extract (free threaded)
  IEIFLAG_CACHE    = $0002;     // returned from the extractor if it does 
NOT cache the thumbnail
  IEIFLAG_ASPECT   = $0004;     // passed to the extractor to beg it to 
render to the aspect ratio of the supplied rect
  IEIFLAG_OFFLINE  = $0008;     // if the extractor shouldn't hit the net to 
get any content neede for the rendering
  IEIFLAG_GLEAM    = $0010;     // Not supported. --does the image have a 
gleam ? this will be returned if it does
  IEIFLAG_SCREEN   = $0020;     // render as if for the screen  (this is 
exlusive with IEIFLAG_ASPECT )
  IEIFLAG_ORIGSIZE = $0040;     // render to the approx size passed, but 
crop ifneccessary

  IEIFLAG_QUALITY   = $200; // passed to the Extract method to indicate that
                              // a slower, higher quality image is desired,
                              // re-compute the thumbnail
var
 FilePath: string;
 shellFolder: IShellFolder;
 pidl: PItemIDList;
 extractImage: IExtractImage;
 Buffer: WideString;
 Priority: Cardinal;
 Flags: Cardinal;
 hr: HRESULT;
 BmpHandle: HBITMAP;
 Size: TSize;
begin
 FilePath := IncludeTrailingBackslash(ExtractFilePath(FileName));

 shellFolder := GetShellFolder(FilePath);

 pidl := ShellFolderParseDisplayName(shellFolder, 
ExtractFilename(Filename));
 try
  //Get the IExtractImage interface of the file
  hr := shellFolder.GetUIObjectOf(
     0, //Parent window for showing a UI (if Windows needs to)
     1, //following pidl contains only one file
     pidl, //the file we want the IExtractImage interface for
     IID_IExtractImage, //give us back an IExtractImage interface
     nil, //Reserved
     extractImage);
 finally
  CoTaskMemFree(pidl);
 end;

 if (hr <> S_OK) then
 begin
  //The item doesn't support IExtractImage
  Result := 0;
  Exit;
   end;

 //Allocate a string as a dummy buffer
 SetLength(Buffer, MAX_PATH);
 Size.cx := PreviewSize;
 Size.cy := PreviewSize;
 Priority := IEI_PRIORITY_NORMAL;
 Flags := IEIFLAG_SCREEN or {IEIFLAG_QUALITY or }IEIFLAG_OFFLINE;
 hr := extractImage.GetLocation(PWideChar(Buffer), Length(Buffer), Priority,
          Size, 32, Flags);
 case hr of
 S_OK,
 Windows.E_PENDING: //E_PENDING means it is pending (and will be done when 
we call Extract)
  begin
   if extractImage.Extract(BmpHandle) = S_OK then
    Result := BmpHandle
   else
    Result := 0;
  end;
 else
  Result := 0;
 end;
end;
date: Tue, 29 Jul 2008 14:43:19 -0400   author:   Ian Boyd

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us