HarmonyOS 是否支持pdf、Word文件预览?

HarmonyOS 是否支持pdf、Word文件预览?

HarmonyOS
2024-11-05 11:40:54
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
FengTianYa

​可以使用web组件实现pdf文件预览。word文档不支持预览,建议转换成pdf文件后进行预览。

相关demo如下,建议在真机上查看预览效果:​

import web_webview from '@ohos.web.webview'; 
@Entry 
@Component 
struct Index { 
  webviewController: web_webview.WebviewController = new web_webview.WebviewController(); 
 
  build() { 
    Column({space:10}) { 
      //预览在线的pdf文件资源 
      Web({ src:'https:xxx', controller: this.webviewController}).domStorageAccess(true) 
      //预览本地的pdf文件资源 
      // Web({ src:$rawfile('git.pdf'), controller: this.webviewController}).domStorageAccess(true) 
    }.width('100%').height('100%').justifyContent(FlexAlign.Center).borderWidth(1) 
  } 
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
分享
微博
QQ
微信
回复
2024-11-05 17:43:16


相关问题
HarmonyOS 如何预览.word/.exe/.ppt/.pdf文件
1176浏览 • 1回复 待解决
HarmonyOS 关于预览PDFword等类型文件
1060浏览 • 1回复 待解决
鸿蒙支持在线pdf,word这些预览功能么
12924浏览 • 3回复 待解决
webview是否支持预览pdf
2292浏览 • 1回复 待解决
HarmonyOS 系统原生能力是否支持PDF预览
1567浏览 • 1回复 待解决
HarmonyOS PDF文件预览
832浏览 • 1回复 待解决
HarmonyOS filePreview 不支持pdf文件预览
1436浏览 • 1回复 待解决
HarmonyOS 使用PDF kit预览PDF文件
823浏览 • 1回复 待解决
HarmonyOS web组件预览PDF文件问题
927浏览 • 1回复 待解决
如何实现pdf文件预览
1312浏览 • 1回复 待解决
HarmonyOS 如何使用API预览word文档
874浏览 • 1回复 待解决
HarmonyOS PDF 预览问题
1202浏览 • 1回复 待解决
HarmonyOS PDF打印及PDF预览失败
1258浏览 • 1回复 待解决