![]() |
【转帖】rouble extracting png bitmap preview picture in asp.net application
trouble extracting png / bitmap preview picture in asp.net application
hello, using the document manager api i have successfully created a vb.net console app that extracts the png preview using the getpreviewpngbitmap() method. but... when i use this same method in a asp.net app, i get the following when i call the method: catastrophic failure (exception from hresult: 0x8000ffff (e_unexpected)) i see the warnings in the api help documentation saying that this function may not work with asp.net, and sure enough i can't get it to work. has anyone run up against this problem? any suggestions? thanks in advance....code below: dim sdocfilename as string = "c:\documents and settings\bcavan\my documents\visual studio 2008\websites\website1\upload\extraction\037-001-876.sldprt" dim sextractdir as string = "c:\documents and settings\bcavan\my documents\visual studio 2008\websites\website1\upload\extraction" dim swclassfact as swdmclassfactory dim swdocmgr as swdmapplication dim swdoc as swdmdocument10 dim swcfgmgr as swdmconfigurationmgr dim vcfgnamearr as object dim vcfgname as object dim swcfg as swdmconfiguration7 dim ppreview as ipicturedisp dim ppreview2 as ipicturedisp dim ndoctype as long dim nretval as long dim i as long dim bret as boolean ndoctype = swdmdocumenttype.swdmdocumentpart swclassfact = createobject("swdocumentmgr.swdmclassfactory") swdocmgr = swclassfact.getapplication("my code") swdoc = swdocmgr.getdocument(sdocfilename, ndoctype, false, nretval) swdoc = ctype(swdoc, swdmdocument10) ppreview2 = swdoc.getpreviewpngbitmap(nretval) ' error occurs here dim myimage2 as image = ipicturetoimage(ppreview2) dim myfilename = path.getfilenamewithoutextension(swdoc.fullname) myimage2.save(sextractdir & "\" & myfilename & ".png") you won't get it to work with asp.net unfortunately. it is due to access permissions on iis. you may be able to tweak the server but i have not bothered to try it yet. i think i can answer my own question now... swdmdocument11::getpreviewbitmapbytes ...it gives me a byte array, which i then successfully wrote to a file... cool! ooooo. never knew about that one, wonder if that works with all out of process applications. how did you get this to work? looking at your code you don't check to see if swdoc is null (nothing) before attempting to get the preview. i have been struggling with this, and i figured it was a permission problem. however, giving 'everyone' (including iusr, network service, etc) permissions on the director i am attempting to pull the document from doesn't work. how did you overcome that barry? just a note to anyone else looking for a solution to this; the fix was simple. all that was required was setting allowreadonly to true for getdocument(). should have known! quick |
所有的时间均为北京时间。 现在的时间是 04:31 PM. |