# PreviewKit-samplecode-Clientdemo-ArkTs **Repository Path**: laughing66/preview-kit-samplecode-clientdemo-arkts ## Basic Information - **Project Name**: PreviewKit-samplecode-Clientdemo-ArkTs - **Description**: 本示例主要展示Preview Kit(文件预览服务)的预览文件功能。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 5 - **Created**: 2024-12-20 - **Last Updated**: 2024-12-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # File Preview ## Introduction This example shows how to integrate the preview function provided by Preview Kit. The Preview Kit API **@kit.PreviewKit** is required. ## Preview Instructions 1. On the home screen of your phone, touch **openPreview** to start the File Preview app. ![](screenshots/device/demoIndex_en.png) ![](screenshots/device/demo_en.png) ## Project Directory ├─entry/src/main/ets │ ├─entryability │ │ └─EntryAbility.ets // Ability for local startup │ ├─pages │ │ └─Index.ets // Basic preview screen ## Implementation Details Define the APIs of Preview Kit in **@kit.PreviewKit**. The following APIs are used to implement services: ``` openPreview(context: Context, file: PreviewInfo, info?: DisplayInfo): Promise; canPreview(context: Context, uri: string): Promise; ``` Before using the service, you need to import the following: import { filePreview } from '@kit.PreviewKit'; See the **entry\src\main\ets\pages\index.ets** file. ## Required Permissions None ## Dependency Depends on the File Preview app. ## Constraints 1. Device: Huawei mobile phones, tablets, and 2-in-1 devices 2. HarmonyOS: HarmonyOS NEXT Developer Beta1 or later 3. DevEco Studio: DevEco Studio NEXT Developer Beta1 or later 4. HarmonyOS SDK: HarmonyOS NEXT Developer Beta1 SDK or later