[python-win32] thumbnails
Renata Marin
renata.marin at gmail.com
Mon Oct 24 11:16:14 CEST 2005
Hello,
I want to find out if a MSOffice document has or not a thumbnail (preview
save picture). If yes I would like to save this thumbnail in a .jpeg file,
if no, i want to save a temporary preview picture of this document and
obtain the thumbnail in a .jpeg file.
Unfortunately this doesn't work. When I do:
> def PrintStats(filename):
> if not pythoncom.StgIsStorageFile(filename):
> print "The file is not a storage file!"
> return
> # Open the file.
> flags = storagecon.STGM_READ | storagecon.STGM_SHARE_EXCLUSIVE
> stg = pythoncom.StgOpenStorage(filename, None, flags )
>
> # Now see if the storage object supports Property Information.
> try:
> pss = stg.QueryInterface(pythoncom.IID_IPropertySetStorage)
> except pythoncom.com_error:
> print "No summary information is available"
> return
> # Open the user defined properties.
> ps = pss.Open(FMTID_UserDefinedProperties)
> props = PIDSI_TITLE, PIDSI_SUBJECT, PIDSI_AUTHOR, PIDSI_CREATE_DTM,
> PIDSI_THUMBNAIL
> data = ps.ReadMultiple( props )
> # Unpack the result into the items.
> title, subject, author, created, thumbnail = data
> print "Title:", title
> print "Subject:", subject
> print "Author:", author
> print "Created:", created.Format()
> print "Thumbnail:", thumbnail
If the thumbnail doesn't exists, it returns None, if It exists, it returns
me :
data = ps.ReadMultiple( props )
> TypeError: Unsupported property type
>
Please, somebody can help me?
thanks
Rena
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20051024/c872c0a2/attachment.html
More information about the Python-win32
mailing list